Support Forums

[Support Guide] Understanding & unregistering service workers

Last checked by Netlify Support Team on September 22, 2021

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) {
} })

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

1 Like
Netlify + Gatsby serves old/cached (pre-Gatsby) version of site
Old version of website shown, works in incognito
Cache Issue on main domain after changes
Cache problems - old versions stay for a long time
Cached index.html
Site not updating
Forms doesn't work in some browsers (Gatsby)
Netlify Function triggered on form submission includes incorrect payload
Do DNS records update automatically when you add a domain you own to a Netlify site?
Primary domain cache problem
Returning users return to cached site after shutting down Netlify site and changed registrar DNS records
Website Not working Even though DNS seems to be correct
Image load then disapear
Redirect from Netlify subdomain to custom primary domain not working
Site not accessible via mobile
Form entries not collected
DNS records on Netlify / external registered domain
I've enabled my site through netlify for https. But my js files are still loaded with 1.1 http protocol
Custom domain doesn't update but netlify.app version does
SSL Certificate not working
“Uncaught SyntaxError: Unexpected token <” on deploy using Netlify
Refresh of Website on Chrome iOS doesn't work, must kill the app + restart
Netlify Form | CRA | ServiceWorker
Should Netlify clear cache when I upload from Gatsby Cloud?
Permanently forward Netlify subdomain to custom TLD
DNS changes not always correct after 48 hours
About caching gatsby pages
Nuxt - Some pages doesn't redirect to the right page correctly after refresh
Netlify serve old cached version
Deployed Gatsby Site Doesn't Represent Development Mode Site
Netlify serve old cached version
React build times out although the required file exists (Error: ENOENT: no such file or directory, open '/opt/build/repo/src/index.js')
Tranform Images not working with Large Media with Sapper
301 redirect not working
Understanding Browser Cache + Netlify
Clear Cache on every deploy
Form submission - correct POST reply, but no entry on the submissions page
Weird situation on multiple Sites. Index page not updating
CACHED and CDNs = next.js?
Site not displaying updated GitHub commits
Returning users return to cached site after shutting down Netlify site and changed registrar DNS records
Site not updating with Github build
Old version of site being seen by sdmin
DNS issues, site can't be reached on Chrome
Form 404 - Static Form in Svelte / Sapper
The deploy is not updated in the main domain
DNS Records Not Resolving and Subdomain Broken
Only getting 404 through proxy
Cache issue on Netlify?
Does netlify clear cache every deploy?
Browser cache not clearing for Safari on custom domain
Cached version of website not updating on new build/repo change
Old version of website shown, what could cause this?

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