Last active
December 21, 2022 19:30
-
-
Save gavinhungry/f5e7137c558a801476dc358b1a7a8bf4 to your computer and use it in GitHub Desktop.
Service Worker Killer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Service Worker Killer | |
// @version 0.4.0 | |
// @description Unregister ServiceWorker(s) before page unload | |
// @author Gavin Lloyd <[email protected]> | |
// @match http://*/* | |
// @match https://*/* | |
// @grant none | |
// ==/UserScript== | |
(() => { | |
window.addEventListener('beforeunload', () => { | |
navigator.serviceWorker.getRegistrations().then(serviceWorkers => { | |
serviceWorkers.forEach(serviceWorker => serviceWorker.unregister()); | |
}); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment