v147 · Service Worker · demo
Reload vs Navigate
A live service worker reads event.request.isReloadNavigation and reports whether this page was loaded by a normal navigation or a user-triggered reload.
⟳ Registering service worker…
This navigation was
isReloadNavigation:
…
Reload this page to see isReloadNavigation: true. Click the link above to navigate here and see isReloadNavigation: false.
// service-worker.js — Chrome 147+
self.addEventListener('fetch', event => {
if (event.request.mode !== 'navigate') return;
const isReload = event.request.isReloadNavigation; // ← new in Chrome 147
// true → user pressed Refresh / called location.reload() / history.go(0)
// false → regular navigation (link, address bar, back/forward)
// Example: choose caching strategy based on navigation type
if (isReload) {
event.respondWith(fetch(event.request)); // network-first: always fresh on reload
} else {
event.respondWith(
caches.match(event.request).then(hit => hit ?? fetch(event.request))
); // cache-first: fast for link navigations
}
});
see also
- Cache Strategy Picker — interactive caching strategy explorer
- Back to feature index
- ChromeStatus entry