Add ignoreSearch to SW Cache fetches

This commit is contained in:
Fred Boniface 2023-03-01 11:38:31 +00:00
parent a0c570c06b
commit 8e2185d185
2 changed files with 28 additions and 28 deletions

View File

@ -64,7 +64,7 @@
</div> </div>
<!-- Footer --> <!-- Footer -->
<footer> <footer>
<p>Created by <a href="https://fredboniface.co.uk" target="_blank" rel="noreferrer noopener">Fred Boniface</a> - 1.0.6</p> <p>Created by <a href="https://fredboniface.co.uk" target="_blank" rel="noreferrer noopener">Fred Boniface</a> - 1.0.7</p>
</footer> </footer>
</body> </body>
</html> </html>

10
sw.js
View File

@ -1,8 +1,8 @@
/* Service Worker */ /* Service Worker */
const appVersion = "1.0.6" const appVersion = "1.0.7"
const cacheName = `owlboard-${appVersion}` const cacheName = `owlboard-${appVersion}`;
const cacheIDs = [cacheName] const cacheIDs = [cacheName];
const cacheFiles = [ const cacheFiles = [
"/404.html", "/404.html",
"/conn-err.html", "/conn-err.html",
@ -42,7 +42,7 @@ const cacheFiles = [
"/images/nav/close.svg", "/images/nav/close.svg",
"/images/nre/nre-powered_400w.webp", "/images/nre/nre-powered_400w.webp",
"/images/nre/nre-powered_400w.jxl" "/images/nre/nre-powered_400w.jxl"
] ];
self.addEventListener("install", (e) => { self.addEventListener("install", (e) => {
console.log("[Service Worker] Install"); console.log("[Service Worker] Install");
@ -58,7 +58,7 @@ self.addEventListener("install", (e) => {
self.addEventListener("fetch", (e) => { self.addEventListener("fetch", (e) => {
e.respondWith( e.respondWith(
(async () => { (async () => {
const r = await caches.match(e.request); const r = await caches.match(e.request,{ignoreSearch: true});
if (r) { if (r) {
return r; return r;
} }