Skip to content

Instantly share code, notes, and snippets.

@volkankaban
Created December 12, 2023 05:09
Show Gist options
  • Save volkankaban/d7efa3c2f8f3e9c43452c411da1c6036 to your computer and use it in GitHub Desktop.
Save volkankaban/d7efa3c2f8f3e9c43452c411da1c6036 to your computer and use it in GitHub Desktop.
JavaScript for unregistering service workers in Chrome, Edge, and Firefox
// Function to unregister all installed service workers in Chrome, Edge, and Firefox
function unregisterServiceWorkers() {
// Select all elements with the class 'unregister'
const unregisterButtons = document.querySelectorAll('.unregister');
// Simulate a click on each button to unregister service workers
unregisterButtons.forEach(button => button.click());
}
// Call the function to unregister service workers
unregisterServiceWorkers();
// To stop the process of unregistering, simply comment or remove the function call
// unregisterServiceWorkers();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment