Skip to content

Commit 40e78f4

Browse files
committed
Try to unregister browser serviceworker left over from previous site. Close #70
1 parent 28a76c4 commit 40e78f4

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

site.hs

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ main = hakyll $ do
2727
route idRoute
2828
compile copyFileCompiler
2929

30+
match "sw.js" $ do
31+
route idRoute
32+
compile copyFileCompiler
33+
3034
-- sponsors --------------------------------------------------------------------------------------------
3135
match "donations/sponsors/*.markdown" $ compile pandocCompiler
3236

templates/boilerplate.html

+13
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@
2222
<link rel="stylesheet" href="/assets/css/main.css">
2323
<link rel="alternate" type="application/rss+xml" href="https://feeds.buzzsprout.com/1817535.rss">
2424
<script src="/assets/js/main.js" defer></script>
25+
<!-- from https://stackoverflow.com/questions/33986976/how-can-i-remove-a-buggy-service-worker-or-implement-a-kill-switch/62154131#62154131
26+
attempt to fix: https://github.com/haskellfoundation/haskellfoundation.github.io/issues/70
27+
-->
28+
<script>
29+
if (navigator && navigator.serviceWorker && navigator.serviceWorker.getRegistration) {
30+
navigator.serviceWorker.getRegistration('/').then(function(registration) {
31+
if (registration) {
32+
registration.update();
33+
registration.unregister();
34+
}
35+
});
36+
}
37+
</script>
2538
</head>
2639
<body class="relative">
2740

0 commit comments

Comments
 (0)