When I decided to make full use Ghost as my CMS (Content Management System), I had to reimplement some features that I previously programmed. As I wanted to quickly ship this new version into production, I chose to skip some features that I might add again in the future. One of these features was that my website was a Progressive Web App (better known as a PWA).
Since I didn't want to ask my visitors to manually clear site data, I had to find a way to delete it programmatically. 🤖
Fortunately, I knew there was a way to remove it using a self-destructing service worker. 🧨
Simply replace your
sw.js) file and the next time a user visits your website, the service worker on its navigator will self-destruct! 💥
A useful snippet to keep on hand if you play with service workers! 🤩
And if your want to know more about removing old services workers, Chrome Developers has a great article on that:
Have fun playing with service workers! 🤗