Step-by-step introduction to the Service Worker API.
To remove a service worker you need to unregister it.
// in page.html
navigator.serviceWorker.getRegistration('./')
.then(reg => {
reg.unregister();
console.log('unregistered sw');
});
Note: The latest version of the service worker will still be used on all pages until they are unloaded. Meaning only subsequent page loads are affected.