Skip to content

Commit d8cc65c

Browse files
committed
kill old service worker
1 parent e72fd5b commit d8cc65c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/layouts/BaseLayout.astro

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ const { description, keywords ,selected} = Astro.props;
99
<head>
1010
<meta charset="utf-8" />
1111
<link rel="icon" href="/favicon.svg" type="image/svg" />
12+
<script>
13+
if ('serviceWorker' in navigator) {
14+
navigator.serviceWorker.getRegistrations().then(registrations => {
15+
for (const registration of registrations) {
16+
registration.unregister().then(() => {
17+
console.log('sw unregistered');
18+
});
19+
}
20+
});
21+
}
22+
</script>
1223
<meta name="viewport" content="width=device-width, initial-scale=1" />
1324
<meta name="description" content={description} />
1425
<meta name="keywords" content={keywords} />

0 commit comments

Comments
 (0)