Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I uninstall a Service Worker?

People also ask

Can I delete service worker?

Removing Service Workers Through The User Interface. You can also remove service workers under the Application tab in Chrome Devtools.

Can I delete service worker folder?

folder. 3 Again come back to the User Data folder, and then go to the Profile X folder and find Service Worker Folder and just delete all the content inside it. And do this for all the Profiles available like Profile 1, Profile 2, and soon.

How do I remove all service workers from Chrome?

Chrome on the Android phone The first thing to do is to go to the site, tap on the site's security padlock (or warning sign ⚠️) and tap on 'Site settings'. Then tap on 'Clear & reset'. Then just refresh the page and you should be good to go!


Removing Service Workers Programmatically

You can remove service workers programmatically like this:

navigator.serviceWorker.getRegistrations().then(function(registrations) {
 for(let registration of registrations) {
  registration.unregister()
} })

Docs: getRegistrations, unregister

Removing Service Workers Through The User Interface

You can also remove service workers under the Application tab in Chrome Devtools.


You can also go to the URL: chrome://serviceworker-internals/ and unregister a serviceworker from there.


You can do this through Chrome Developer Tool as well as Programatically.

  1. Find all running instance or service worker by typing

    chrome://serviceworker-internals/

    in a new tab and then select the serviceworker you want to unregister.

  2. Open Developer Tools (F12) and Select Application. Then Either

    Select Clear Storage -> Unregister service worker

    or

    Select Service Workers -> Choose Update on Reload

  3. Programatically

if(window.navigator && navigator.serviceWorker) {
  navigator.serviceWorker.getRegistrations()
  .then(function(registrations) {
    for(let registration of registrations) {
      registration.unregister();
    }
  });
}

In Google Chrome, you can go to Developer tools (F12) -> Application -> Service worker and unregister the service workers from the list for that specific domain.

Screenshot

This method is effective in development mode of a site and mostly they run on localhost which is you may need for other project's development.


FYI, in case you are using MacOS Safari browser, there is one way to forcibly unregister a service worker (steps and images for Safari 12.1):

  1. Safari > Preferences... > Privacy > Manage Website Data… Safari Preferences : Privacy

  2. Enter domain name (ex. 'localhost'), click "Remove" Safari Preferences : Privacy : manage website data

Note: In addition to service workers, this also will erase all caches, cookies, and databases for this domain.


You should detecte two API in your devices: getRegistrations and getRegistration. The service-worker not has a unique set of APIs in all platforms. For example, some browsers only have a navigator.serviceWorker.getRegistration, no navigator.serviceWorker.getRegistrations. So you should consider with both.