generated from nhcarrigan/template
fix: add script to unregister old service worker
The browser was still trying to load the deleted service worker file, causing errors. Added a script that runs on page load to unregister any existing service worker registrations. This ensures a clean slate after removing PWA functionality.
This commit is contained in:
@@ -20,6 +20,16 @@
|
||||
});
|
||||
</script>
|
||||
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3569924701890974" crossorigin="anonymous"></script>
|
||||
<script>
|
||||
// Unregister any existing service workers
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.getRegistrations().then(function(registrations) {
|
||||
for(let registration of registrations) {
|
||||
registration.unregister();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<app-root></app-root>
|
||||
|
||||
Reference in New Issue
Block a user