👨💻 By Dave Geddes
To register as a Service Worker with the js file -
Four stages of Service Worker
Once the Service Worker is installed in the browser, it cannot be updated when the same site’s Service Worker code is updated
A new Service Worker is created for the new code.
When a new service worker is created, it will be in the “waiting phase” as the active service worker will still be active.
When you edit the service worker code with new line of code, service worker will terminate the new waiting service worker and creates a new waiting service worker.
Simple refresh cannot affect the active service worker.
Now with the new code, closing the internet will terminate the active service worker and waiting service worker will become active and stopped.
It’s still recommended that you configure the
Cache-Control headers on your web server, even when you know that you’re using the
Cache Storage API. You can usually get away with setting
Cache-Control: no-cache for unversioned URLs, and/or
Cache-Control: max-age=31536000 for URLs that contain versioning information, like hashes.
Access the service Workers using Chrome Internal -
Access the service Workers using Firefox Internal -