diff --git a/static/demos/light-dark-superior_v1/script.js b/static/demos/light-dark-superior_v1/script.js
index 59135ab..f9a63c7 100644
--- a/static/demos/light-dark-superior_v1/script.js
+++ b/static/demos/light-dark-superior_v1/script.js
@@ -39,6 +39,6 @@ else setupServiceWorker();
async function setupServiceWorker() {
await navigator.serviceWorker.register("sw.js", {
// we only need to interact with index.html for this demo
- scope: "./index.html"
+ scope: "./"
});
}
diff --git a/static/demos/light-dark-superior_v1/sw.js b/static/demos/light-dark-superior_v1/sw.js
index b8ce162..4685f00 100644
--- a/static/demos/light-dark-superior_v1/sw.js
+++ b/static/demos/light-dark-superior_v1/sw.js
@@ -19,10 +19,12 @@ async function fetchResponse(event) {
}
// this is a brittle way of accomplishing our desired behavior
body.replace(``,
- ``)
+ ``);
+ return new Response(body, resp);
}
self.addEventListener('fetch', (event) => {
+ if (!event.request.url.endsWith(".html")) return;
//https://developer.mozilla.org/en-US/docs/Web/API/FetchEvent/respondWith
event.respondWith(fetchResponse(event));
})