Your code uses browser APIs that are scheduled for removal. When browsers finally drop support, your site will break—fix these now while you still can.
Browser vendors deprecate APIs when better alternatives exist or when the API poses security/privacy risks. Deprecated APIs continue working for a grace period (months to years), but eventually get removed entirely. Lighthouse catches these early by monitoring Chrome's deprecation warnings.
When your JavaScript calls a deprecated API, Chrome logs a warning and reports it through the DevTools Protocol. Lighthouse collects these warnings and fails this audit if any are found. Common culprits include legacy DOM methods, outdated security APIs, and obsolete media features.
Typical deprecation warnings look like:
[Deprecation] 'window.webkitStorageInfo' is deprecated. Please use 'navigator.storage' instead.
[Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated.
[Deprecation] 'document.domain' setter is deprecated.
The Lighthouse "Uses deprecated APIs" audit lists each deprecation with:
Once you know which APIs are flagged, search your code:
grep -r "webkitStorageInfo" --include="*.js" src/
grep -r "document.domain" --include="*.js" src/
Each deprecated API has a recommended replacement. Here are common deprecations and their fixes:
document.domain setter:
// Deprecated: relaxing same-origin policy
document.domain = 'example.com'
// Modern: use postMessage for cross-origin communication
window.parent.postMessage(data, 'https://example.com')
Synchronous XMLHttpRequest:
// Deprecated: blocks main thread
const xhr = new XMLHttpRequest()
xhr.open('GET', url, false) // sync = false is deprecated
// Modern: use async fetch or XHR
const response = await fetch(url)
const data = await response.json()
webkitStorageInfo:
// Deprecated: webkit-prefixed storage API
window.webkitStorageInfo.queryUsageAndQuota(...)
// Modern: Storage API
const estimate = await navigator.storage.estimate()
console.log(`Using ${estimate.usage} of ${estimate.quota} bytes`)
Event.path:
// Deprecated: non-standard event property
const path = event.path
// Modern: use composedPath()
const path = event.composedPath()
KeyboardEvent.keyCode:
// Deprecated: numeric key codes
if (event.keyCode === 13) { /* Enter */ }
// Modern: use key property
if (event.key === 'Enter') { /* Enter */ }
If deprecation warnings come from third-party scripts:
// Check if the issue is from node_modules
// Lighthouse shows source file paths in the audit
// Option 1: Update the dependency
npm update problematic-package
// Option 2: Find an alternative package
npm uninstall old-package
npm install modern-alternative
// Option 3: If it's a CDN script, check for newer versions
// <script src="https://cdn.example.com/lib@latest/lib.min.js">
If you can't immediately replace a deprecated API, polyfill it to suppress warnings while you plan the migration:
// Temporary polyfill for Event.path
if (!Event.prototype.composedPath) {
Event.prototype.composedPath = function () {
const path = []
let el = this.target
while (el) {
path.push(el)
el = el.parentElement
}
path.push(document, window)
return path
}
}
Note: Polyfills mask the problem but don't solve it. Plan for proper migration.
if (window.webkitStorageInfo) can trigger deprecation warnings in some browsers.Different pages may load different scripts, each potentially using deprecated APIs. A full site scan catches deprecations across all your JavaScript.
Scan Your Site with Unlighthouse