Cache-proof asset URLs and inline iOS touch icon
Publish Container / publish (push) Successful in 2m42s
Publish Container / publish (push) Successful in 2m42s
A reverse proxy in front of the app serves stale copies of static files for hours (live app.js and sw.js were old next to new HTML). iOS also showed a letter tile (N / S) because its separate icon download failed. - HTML pages are served through a versioner: every local script/stylesheet/icon/manifest gets a content-hash query (app.js?v=…), so any change is a URL no proxy or phone has cached - Service worker URL versioned too; SW offline lookups tolerate the query string; cache v15 - The 180px apple-touch-icon is embedded in each page as a data: URI, so the Home Screen icon no longer depends on a second network request Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f21c91527c
commit
0cbebfef2a
2 files changed
+67
-9
No files matched your search
+3
-3
@@ -4,7 +4,7 @@ self.addEventListener('message', event => {
|
||||
if (event.data === 'skipWaiting') self.skipWaiting();
|
||||
});
|
||||
|
||||
const CACHE = 'weather-v14';
|
||||
const CACHE = 'weather-v15';
|
||||
|
||||
// App shell cached on install for offline resilience.
|
||||
const PRECACHE = [
|
||||
@@ -101,14 +101,14 @@ self.addEventListener('fetch', event => {
|
||||
}
|
||||
return response;
|
||||
})
|
||||
.catch(() => caches.match(request).then(cached => cached || caches.match('/')))
|
||||
.catch(() => caches.match(request, { ignoreSearch: true }).then(cached => cached || caches.match('/', { ignoreSearch: true })))
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Cache-first for static assets.
|
||||
event.respondWith(
|
||||
caches.match(request).then(cached => {
|
||||
caches.match(request, { ignoreSearch: true }).then(cached => {
|
||||
if (cached) return cached;
|
||||
return fetch(request).then(response => {
|
||||
if (response.ok && (
|
||||
|
||||
Reference in new issue
Block a user