Blink‎ > ‎ServiceWorker‎ > ‎

Service Worker FAQ

Q: How do I tell if it is "working"?
A: If you expect a ServiceWorker to be running, chrome://inspect/#service-workers ; otherwise chrome://serviceworker-internals to see the registrations. If there are none, they will be empty.


Q: It's not working!
A:  Make sure you've enabled Service Worker. In the Inspector, see if navigator.serviceWorker is defined. If not, check the following requirements:
  • Install and use Chrome Canary
  • Enable the Experimental Web Platform Features flag
    1. open a new tab
    2. head over to chrome://flags/#enable-experimental-web-platform-features
    3. click on enable
    4. close and restart Chrome for the change to take effect
On Linux, you can build Chrome or use Chrome Dev Channel.

(Versions prior to Chrome Canary have an additional Enable Service Worker flag, and both flags must be enabled to use Service Worker. In Canary, that flag is rolled into the Experimental Web Platform Features flag.)

Q: How do I debug?
A: chrome://inspect/#service-workers . If you need to debug the event listener wire-up (ie startup first eval) use chrome://serviceworker-internals .

Q: What are those buttons on chrome://serviceworker-internals?
This page shows your registered workers and provides some basic operations.

Unregister: Unregisters the worker.
Start: Starts the worker. This would happen automatically when you navigate to a page in the worker's scope.
Stop: Stops the worker.
Sync: Dispatches a 'sync' event to the worker. If you don't handle this event, nothing will happen.
Push: Dispatches a 'push' event to the worker. If you don't handle this event, nothing will happen.
Inspect: Opens the worker in the Inspector.


Q: I made a change to my service worker. How do I reload?
A: This is currently painful. Dominic suggests to add unregister-register buttons in your UI for debugging purposes and reload. Alternatively, you can use chrome://serviceworker-internals  (TODO Kenji to ask slightlyoff about his opinion on a better workflow).

If you still have difficulty installing the newest version, you might try blowing away your entire browser cache and Service Worker database. On Linux, this is:
rm -rf ~/.cache/chromium/Default/Cache/ ~/.config/chromium/Default/Service\ Worker/  # deletes your browser cache and all Service Worker state!



Q: The cache API doesn't match the spec.
A: Currently, it's just an interim polyfill. Feel free to star the native cache API bug to get updates on our progress toward the real thing.


Q: I have a different question.
A: Leave a comment here or reach us out via blink-dev (make sure to include Service Worker in the subject of your email).
Comments