Skip to content

Instantly share code, notes, and snippets.

@johngrimes
Created February 7, 2018 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johngrimes/541edc3197a4c2632230d8af22e5a185 to your computer and use it in GitHub Desktop.
Save johngrimes/541edc3197a4c2632230d8af22e5a185 to your computer and use it in GitHub Desktop.
De-register service workers

De-registers any service workers, if the browser supports service worker and if there are any present.

if (navigator.serviceWorker) {
  navigator.serviceWorker.getRegistrations().then(function(registrations) {
    for (let registration of registrations) {
      registration.unregister()
    }
  })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment