Skip to content

Instantly share code, notes, and snippets.

Created March 24, 2022 18:26
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Nuke a service worker from inside a service worker
// put this in a file where your service worker used to live, like You can find out this path in the SW dev tools of your browser
self.addEventListener('install', (e) => {
console.log('[Service Worker] Installing Service Worker ...', e);
self.addEventListener('activate', (e) => {
console.log('[ServiceWorker] Activate');
.then(() => self.clients.matchAll())
.then((clients) => {
clients.forEach((client) => client.navigate(client.url));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment