service-worker.js. You still host and register it.
Vanilla Cache API: precache URLs on install, then network-first, cache-first, stale-while-revalidate, network-only, or cache-only.
Optional offline fallback and a navigator.serviceWorker.register snippet. Not Workbox. One 404 in addAll fails the whole install.
Bump this when you change precache or breaking cache logic.
Must match where you deploy the generated file.
Passed to cache.addAll on install — every URL must respond successfully or install can fail.
Used for navigate requests when network/cache miss handling allows (strategy-dependent). Precache this page if you rely on it offline.
Use it for a small vanilla Cache API worker: precache a short URL list, pick a fetch strategy, optional offline HTML, plus a register() snippet.
Do not treat this as Workbox, a PWA audit, or an installability check. Pair it with a manifest.json if you want a home-screen icon — that is a separate file. Service workers need HTTPS or localhost.
Strategies: network-first, cache-first, stale-while-revalidate, network-only, cache-only. Precache uses cache.addAll — one 404 fails the whole install.
Non-GET requests are left alone so forms are not cached. skipWaiting / clients.claim / prune-old-caches are checkboxes.
Cache name shell-v2, network-first, precache / and /offline.html:
const CACHE_NAME = "shell-v2"; const PRECACHE_URLS = [ "/", "/offline.html", ];
Host the JS at the path you typed in “Register path”. Then Application → Service Workers in Chrome. If install fails, one precache URL is wrong or CORS-blocked.
PWA manifest generator · SPA .htaccess fallback
No. Text only. You upload it to your origin.
Any missing precache URL fails install. Check each path returns 200.
Old workers wait for tabs to close unless skipWaiting + claim. Add a “reload” UX.
Not for the worker. Yes for install branding.