v147 · Service Worker · Web APIs

History State Manager

A multi-page navigation simulator that tracks each entry in the history stack and labels it with the navigation type a service worker's FetchEvent.request.isReloadNavigation would see: fresh navigation, reload, or back/forward.

Checking Request.isReloadNavigation support…
History Stack
    Service Worker Intercept Log

    Use case: skip re-fetching user data on reload isReloadNavigation

    When the user reloads, they want fresh content. When they navigate away and come back via Back, stale cached data is usually fine. isReloadNavigation makes this distinction explicit — no referrer heuristics, no global state.

    How the simulation works

    This page simulates what a service worker's fetch event handler sees. In a real service worker, event.request.isReloadNavigation is true only when the user explicitly reloads (Refresh button, location.reload(), F5, Ctrl+R). Regular link clicks and address-bar navigations return false. Back/forward cache navigations are never fetch events — the page is restored from bfcache, so the service worker is not invoked at all.

    The simulator uses performance.getEntriesByType('navigation')[0].type to read the real navigation type for the current page load, and models subsequent navigations in-page.

    References