[Support Guide] Understanding & unregistering service workers

A service worker is a script that your browser runs in the background to accomplish a variety of tasks. Browsers cache service workers for 24 hours by default, and don’t update them when you reload your page. Therefore, you may have a service worker on your site which could prevent you from seeing the latest and greatest changes that you’ve made.

If you suspect a service worker is causing this issue, I recommend disabling/removing the service worker from your site and unregistering it to see your latest change. You can unregister by going to your browser dev tools, under 'Application > Service Workers', there will be an option to unregister your current service worker.

Alternatively, you can use the following snippet in a javascript file or in the dev tools console:

navigator.serviceWorker.getRegistrations().then(function(registrations) {
  for(let registration of registrations) {
    registration.unregister()
    document.location.reload()
} })

If you have a different issue with a service worker, or need more information, comment below!

Browsers cache service workers for 24 hours by default

read up a bit on this and found this https://stackoverflow.com/questions/38843970/service-worker-javascript-update-frequency-every-24-hours

" The one exception to standard HTTP caching rules, and this is where the 24 hours thing comes in, is that browsers will always go to the network if the age of the service-worker.js entry in the HTTP cache is greater than 24 hours. So, functionally, there’s no difference in using a max-age of 1 day or 1 week or 1 year—they’ll all be treated as if the max-age was 1 day."

1 Like