diff options
Diffstat (limited to 'src/worker.ts')
| -rw-r--r-- | src/worker.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/worker.ts b/src/worker.ts index 0a9f1ec..1082379 100644 --- a/src/worker.ts +++ b/src/worker.ts @@ -124,7 +124,9 @@ sw.addEventListener('fetch', (event) => { return; } // index & read UI: online first; if offline, map index pages to offline.html & map all read.html?* to offline read.html - if (url.pathname == "/" || url.pathname.match("index.html|offline.html|read.html")) { + // note that instead of hardcoding specific URLs, we handle all user-initiated explicit page navigation requests, + // everything else falls back to the next block with cache-first-online-fallback logic + if (event.request.mode === 'navigate') { (event as any).respondWith((async () => { try { const networkResp = await fetchWithTimeout((event as any).request); |
