On this page
What this issue is
A service worker is a JavaScript file that your site registers in the visitor's browser. It sits between the page and the network and can reply to requests from a local cache. Progressive web apps, some themes and some plugins use it to make sites load faster or work offline.
The problem starts when the worker holds on to old files. It may serve an old HTML page that points to scripts you have since deleted. It may serve an old form script, an old checkout page or an old tracking tag. You deploy a fix, you see it working, and a returning visitor still sees the broken version.
Common causes: a cache-first rule applied to HTML pages, a cache name that never changes, no cleanup of old caches, or the sw.js file itself being cached by the browser or CDN so the update is never found.
Why it costs you leads or sales
Stale caches are hard to notice because you and your developer usually see the fixed site. Returning visitors, often your warmest leads and repeat buyers, keep the old copy. They may hit a form that posts to a retired endpoint, a checkout script that no longer matches the server, or a page with an old price or offer.
Tracking can break too. An old cached page may carry an outdated tag setup, so conversions go missing from ad platforms even though the funnel looks fine to you.
- You deploy a fixNew HTML and scripts go live on the server
- Returning visitor opens pageBrowser asks the service worker first
- Worker serves cached copyOld HTML points to old or missing scripts
- Form or checkout failsScript error or old endpoint
- ConversionLead or sale never recorded
The worker answers from its cache, so the fixed version never reaches the browser.
The cached page loads, but the scripts it expects no longer match the server.
How to check if your site has it
Open DevTools Application panelCustom code
Open your site, press F12 (Cmd+Option+I on Mac), and go to Application, then Service workers. If a worker is listed with a status like 'activated and running', your site uses one.
Look for waiting workers
A second entry marked 'waiting to activate' means a new version is downloaded but the old one is still in control. That is a classic stale cache sign.
Inspect the cached files
Under Application, then Cache storage, open each cache and check whether it holds HTML pages or old script filenames.
Compare cached and live
Tick 'Bypass for network' in the Service workers panel and reload. If the page now behaves differently or the error disappears, the worker is serving a stale copy.
Test as a returning visitor
Visit the site in a normal window before a deploy, deploy a change, then reload without clearing anything. If you still see the old version, updates are not reaching returning visitors.
Check the worker file headers
In the Network panel, select sw.js and look at Cache-Control. A long max-age on this file delays updates.
How to fix it
The right fix depends on whether you want the service worker at all. If it is not giving you a clear benefit, remove it. If you need it, change its caching rules so pages are always fresh.
Find what registers the worker
Check PWA, caching and performance plugins (for example a PWA plugin or an offline mode setting). Look at the page source for navigator.serviceWorker.register.
Disable or update the plugin setting
Turn off offline or PWA mode, or switch the HTML caching strategy to network-first if the plugin offers it.
Purge caches
Clear your caching plugin and CDN caches so the changed sw.js is served fresh.
Ship a cleanup worker if needed
If visitors still hold the old worker after you remove the plugin, serve a replacement sw.js that unregisters itself (see the code below).
Check theme and apps
Shopify themes do not normally need your own worker. If one exists, it usually comes from a theme or an installed app. Search the theme code and app settings for serviceWorker.
Remove or update it
Disable the app feature or delete the registration code in the theme, then publish.
Test checkout paths
Place a test order in a fresh and a returning browser profile to confirm both see the same pages.
Search custom code
Look in Project settings, Custom code and page-level embeds for navigator.serviceWorker.register.
Remove the registration
Delete the snippet and republish the site.
Unregister for existing visitors
Webflow cannot host a root-level sw.js file easily, so add a short script that unregisters existing workers (see the code below).
Serve HTML network-first
Never use cache-first for HTML documents or API calls. Use cache-first only for fingerprinted static assets.
Version your cache and clean up
Change the cache name on each release and delete old caches in the activate event.
Do not cache sw.js
Serve sw.js with Cache-Control: no-cache so browsers find updates.
Take control promptly
Use skipWaiting and clients.claim only if your pages and scripts stay compatible when a new worker takes over mid-session.
const CACHE = 'site-v2025-01-15';
self.addEventListener('install', () => self.skipWaiting());
self.addEventListener('activate', (event) => {
event.waitUntil(
caches.keys()
.then((keys) => Promise.all(keys.filter((k) => k !== CACHE).map((k) => caches.delete(k))))
.then(() => self.clients.claim())
);
});
self.addEventListener('fetch', (event) => {
const req = event.request;
if (req.method !== 'GET') return;
if (req.mode === 'navigate') {
event.respondWith(
fetch(req).catch(() => caches.match(req))
);
return;
}
event.respondWith(
caches.match(req).then((hit) => hit || fetch(req).then((res) => {
const copy = res.clone();
caches.open(CACHE).then((c) => c.put(req, copy));
return res;
}))
);
});// Serve this as /sw.js to replace a bad worker:
self.addEventListener('install', () => self.skipWaiting());
self.addEventListener('activate', (event) => {
event.waitUntil(
caches.keys()
.then((keys) => Promise.all(keys.map((k) => caches.delete(k))))
.then(() => self.registration.unregister())
.then(() => self.clients.matchAll())
.then((clients) => clients.forEach((c) => c.navigate(c.url)))
);
});
// Or, from a page script:
if ('serviceWorker' in navigator) {
navigator.serviceWorker.getRegistrations().then((regs) => regs.forEach((r) => r.unregister()));
}location = /sw.js {
add_header Cache-Control "no-cache";
}Before
- HTML cached cache-first
- Cache name never changes
- Old caches never deleted
- sw.js cached for days
After
- HTML fetched network-first
- Cache name versioned per release
- Old caches deleted on activate
- sw.js served with no-cache
How to confirm it's fixed
Load the site with the old worker
Use a browser profile that visited before the fix and has not been cleared.
Reload twice
In DevTools, Application, Service workers, confirm the new worker becomes 'activated' and no worker is stuck 'waiting'.
Check cache storage
Only the current versioned cache should remain.
Run the full journey
Submit a test lead or reach the checkout (stop before payment) and check the Console for errors.
Check sw.js headers
Confirm Cache-Control is no-cache or a very short max-age.
How to prevent it happening again
- Ask whether you really need a service worker for a lead or sales site
- Never cache HTML or API responses cache-first
- Version cache names on every deploy
- Delete old caches in the activate event
- Serve sw.js with Cache-Control: no-cache
- Test every release in a profile that already has the previous version installed
- Keep fingerprinted file names for scripts and styles
- Add a note to your release checklist to check Application, Service workers
Day 0
Worker installed and caches pages cache-first
Day 10
You deploy a new form script and remove the old one
Day 10
Returning visitors still get cached HTML that loads the deleted script
Day 14
Leads from returning visitors drop, but new visitors convert normally
Day 15
You ship a versioned worker and no-cache sw.js
How FunnelGuard handles this
FunnelGuard does not check for this yet. Detecting a stale service worker is a possible future check, not something it does today.
What FunnelGuard does do is run your real journeys (lead forms, checkouts, booking and chat buttons) on a schedule from the EU or the US, check each step and the tracking hits sent to platforms such as GA4, Google Ads and Meta, and confirm test leads reach your inbox and CRM. A failure is re-checked from a second region before one alert goes out. Because a robot visitor usually starts clean, it may not hold an old worker, so it can miss a problem that only affects returning visitors.
To watch for this yourself, add the service worker check to your release routine: open the site in a browser profile that has visited before, deploy, reload, and confirm Application, Service workers shows no waiting worker. You can also try the free plan (1 site, 2 journeys, daily checks, no card) to cover the broader funnel while you do this manually.
Questions people ask
Why is my website showing an old version after I updated it?
If browser refresh and server cache purges do not help, a service worker may be answering from its own cache. Open DevTools, Application, Service workers, and tick 'Bypass for network'. If the new version appears, the worker is serving stale files.
How do I unregister a service worker?
For yourself, open DevTools, Application, Service workers and click Unregister. For all visitors, serve a replacement sw.js that deletes caches and calls self.registration.unregister(), and leave it live for a few weeks.
How do I clear a service worker cache in Chrome?
Open DevTools, go to Application, then Storage, and click 'Clear site data'. You can also open Cache storage and delete individual caches. This only fixes your own browser, not your visitors'.
Why is my service worker update stuck on 'waiting to activate'?
A new worker waits until all tabs using the old one are closed. You can call skipWaiting() in the install event to activate it immediately, but only if your pages stay compatible when the worker changes mid-session.
Can a service worker break my checkout or contact form?
Yes. If it serves cached HTML or scripts that no longer match the server, forms can post to old endpoints or throw script errors. Returning visitors are the most affected.
Should I cache HTML in a service worker?
For lead and sales funnels, serve HTML network-first, falling back to cache only when offline. Cache-first HTML is the main cause of visitors seeing outdated pages.
Why is sw.js not updating?
The file is probably cached by the browser, a CDN or a caching plugin. Serve sw.js with Cache-Control: no-cache and purge your CDN so browsers can fetch the new version.
Does FunnelGuard detect a stale service worker?
No, not yet. It is a possible future check. FunnelGuard does run your real funnel journeys on a schedule and checks steps, tracking and test leads, but you should check service worker state manually after deploys.
Related issues
- PRF-122JS bundle 404 after deploy (stale cached HTML referencing old hashes)Fix guide
- PRF-123ChunkLoadError on lazily loaded routeFix guide
- PRF-116Uncaught JavaScript exception on page loadFix guide
- PRF-117Console error on a funnel stepFix guide
- PRF-131localStorage/cookies unavailable (private mode) breaks the appFix guide
- PRF-133Page stuck on loading spinner foreverFix guide