Esta página ainda não está disponível em Português, por isso está a ler a versão em inglês.

Debugging service workers in Chrome, Edge, Firefox and Safari

Where to look when the cache will not let go.

Service workers Intermediário 2 min de leitura Revisado em 27 de nov. de 2026

Chrome and Edge DevTools

Open DevTools, then the Application panel:

  • Manifest: shows parsed fields, icon previews, the computed id, and install warnings. Start here if the install button does not appear.
  • Service workers: status of each version, with buttons to Update, Unregister, push a test message, or trigger a sync. Tick Update on reload while developing so every reload installs the newest sw.js. Bypass for network skips the worker entirely.
  • Storage: shows usage, and Clear site data wipes caches, IndexedDB, cookies and the registration in one click.
  • Cache storage: browse every cache and entry; right-click to delete.
  • Background services: record push, sync, background fetch and notification events, even while DevTools is closed.

In the Network panel, responses served by the worker show "(ServiceWorker)" in the Size column, and the Offline checkbox simulates no connection. chrome://serviceworker-internals and edge://serviceworker-internals list every registration in the browser.

To debug the worker itself, pick its context in the console drop-down, or open chrome://inspect/#service-workers.

Firefox

about:debugging#/runtime/this-firefox lists service workers with Inspect, Push and Unregister. The Storage panel in DevTools shows Cache Storage and IndexedDB. Firefox for Android can be debugged from desktop over USB the same way.

Safari

Enable Show features for web developers in Safari settings, then use Develop > Service Workers to inspect each one. To debug a Home Screen web app on an iPhone or iPad, connect it to a Mac with a cable, enable Web Inspector on the device (Settings > Apps > Safari > Advanced), and pick the app under the device's name in the Develop menu.

Android devices

Connect the phone with USB debugging enabled and open chrome://inspect on your computer. Installed PWAs appear as their own targets.

Common problems and fixes

ProblemLikely causeFix
Changes do not show upOld worker still active; new one waitingClose all tabs, or use an update prompt. In development, tick Update on reload.
Worker never updatessw.js cached by a CDN or browserServe sw.js with Cache-Control: no-cache; check your CDN rules.
addAll fails on installOne precached URL returned 404 or a redirectCheck every URL; addAll fails if any request fails.
Offline shows the browser errorNavigation request not handled, or the offline page is not cachedHandle request.mode === 'navigate' and precache the offline page.
Pages work but images are missing offlineImages not cachedAdd a runtime cache for images.
Scope error on registerWorker file is in a sub-folderMove sw.js to the root, or send Service-Worker-Allowed.
Works on localhost, not in productionNot HTTPS, or wrong MIME typeServe over HTTPS with Content-Type: application/javascript.
Logged-in users see someone else's pagePersonalised HTML cachedNever cache personalised responses with a shared key.

A clean slate

// Paste in the page's console to remove every registration and cache for this origin
(async () => {
  for (const r of await navigator.serviceWorker.getRegistrations()) await r.unregister();
  for (const k of await caches.keys()) await caches.delete(k);
  location.reload();
})();