mirror of
https://codeberg.org/vlw/victorwesterlund.com.git
synced 2025-09-13 19:13:42 +02:00
Update sw.js
This commit is contained in:
parent
e8dd97a291
commit
9a2e937f1b
1 changed files with 3 additions and 4 deletions
|
@ -50,7 +50,6 @@ function fetchContent(event) {
|
|||
|
||||
self.addEventListener("fetch", event => {
|
||||
const url = new URL(event.request.url);
|
||||
|
||||
const origin = (url.origin == location.origin) ? true : false; // Is same-origin
|
||||
|
||||
// Fetch cross-origin content
|
||||
|
@ -59,10 +58,10 @@ self.addEventListener("fetch", event => {
|
|||
return;
|
||||
}
|
||||
|
||||
// Get pattern.gif from generator. Fall back to cache on failure
|
||||
// Get pattern.gif from generator. Fallback to cache on failure
|
||||
if(origin && url.pathname.endsWith("pattern.gif")) {
|
||||
const pattern = new Request(`${location.origin}/${root}/assets/img/pattern.php`);
|
||||
event.respondWith(fetch(pattern) || caches.match(event.request).then(response => response));
|
||||
const pattern = new Request(`${location.origin}/${root}assets/img/pattern.php`);
|
||||
event.respondWith(fetch(pattern) || caches.match(url.pathname).then(response => response));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue