Browser troubleshooting
Check whether a service worker serves stale content
If a deployed page stays stale after an update, inspect service-worker registrations and cache behavior before repeatedly editing the source. A registered worker can serve responses independently of the normal network cache.
Worked example
Browser console example · use a disposable page on your own site
if ("serviceWorker" in navigator) {
const registrations = await navigator.serviceWorker.getRegistrations();
console.log(registrations.map(item => item.scope));
} else {
console.log("Service workers unavailable");
}How it works
The read-only inspection lists registrations visible in the current context. Their scopes show which paths a worker may control. Use the browser’s application tools to inspect the active worker and cached responses when the displayed content differs from the server response.
Limits and mistakes
Do not unregister every worker or clear every cache automatically in a live application. That can remove offline behavior and stored data. A stale response may also come from a CDN or ordinary HTTP cache rather than a worker.
Check the result
Compare the network response, controller state, and worker registration on the affected page. Test any update fix in a controlled profile and verify the new version loads after the intended lifecycle.
Sources
Reference documentation for the behavior used in this guide: