Skip to content

Instantly share code, notes, and snippets.

@rjbultitude
Created June 1, 2021 14:43
Show Gist options
  • Save rjbultitude/26afc030bb9f108850364cb8fc92e2d9 to your computer and use it in GitHub Desktop.
Save rjbultitude/26afc030bb9f108850364cb8fc92e2d9 to your computer and use it in GitHub Desktop.
navigator.serviceWorker.getRegistrations()
.then(function(registrations) {
for(let registration of registrations) {
registration.unregister()
.then(function() {
return self.clients.matchAll();
})
.then(function(clients) {
clients.forEach(client => {
if (client.url && "navigate" in client) {
client.navigate(client.url);
}
});
})
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment