From the course: JavaScript: Service Workers

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Unregister the service worker

Unregister the service worker - JavaScript Tutorial

From the course: JavaScript: Service Workers

Start my 1-month free trial

Unregister the service worker

- [Instructor] Back to our code in video 10 of chapter two, it's time to talk about unregistering service worker. On most of the browser, your service worker will leave and be activated mostly forever. So it's not going to disappear automatically. Safari is the only browser that, right now, might delete and unregister your service worker after a few weeks of inactivity. So if the user is not going back to your website, Safari might delete your service worker. But let's say that, in the future, maybe in a year, you don't want the service worker anymore in your current scope. Probably you are thinking, well, let's delete the file. So let's take the service worker in the server and delete the file. And then, when the browser is doing the check algorithm, it will verify that there is no service worker in the server, and will delete the service worker registration in the client. Well, that's not how it works. If you delete the file in the server, the client will never unregister the…

Contents