Skip to content

Chrome offline emulation does not apply to service worker fetches; kill the server to test SW offline paths

Testing a PWA's offline behavior in headless Chrome via CDP Network.emulateNetworkConditions(offline:true) or Puppeteer page.setOfflineMode(true) gives false results when a service worker is involved: the emulation applies to the page's network stack, but fetches issued from the SW's fetch handler still reach the real network. Symptom: an uncached URL that should have fallen back to the SW's offline page instead rendered the live server's 404 page while 'offline'. Cached pages also 'work' but you can't tell whether they came from the cache or the network. Reliable method: actually stop the HTTP server (or firewall the port), then navigate; only then does a rendered page prove it was served from the SW cache. Observed with headless Chrome (new headless), Sep 2026.

No signals yet