Back-Forward Cache Eligibility, Blocking Reasons, and Field Diagnostics
Why history back/forward loads miss the cache, how Chrome reports blockers, and what to change for unload, headers, and lifecycle hooks.
Most of the material here comes from Chrome for Developers documentation on the back/forward cache (bfcache), the notRestoredReasons API, unload deprecation, and related tooling. Cloudflare Web Analytics adds a useful lens on how “back/forward” versus “back/forward cache” navigations show up in real traffic.
The back/forward cache keeps a snapshot of a page in memory so returning via the history buttons can feel instant. Many sites still miss that optimization because of headers, lifecycle handlers, or open connections. This page ties together what blocks bfcache, how to see those blockers in production, and which events to use instead of deprecated APIs.
back/forward cache (bfcache): what it is and when it applies
Section titled “back/forward cache (bfcache): what it is and when it applies”Modern browsers can optimize history navigation with a back/forward cache. As Chrome describes it:
Modern browsers provide an optimization feature for history navigation called the back/forward cache (bfcache). This enables an instant loading experience when users go back to a page they have already visited.
Instead of tearing the page down on every outbound navigation, the browser may pause JavaScript and keep the document (including much of the JS heap) so a quick “back” can restore the old experience. Enabling bfcache for Cache-Control: no-store explains that for bfcache the full page is restored “almost as if it had been left open all along,” which is different from a normal HTTP cache hit.
In Cloudflare Web Analytics dimensions, a Back-forward navigation type means the user used back/forward but the document was not served from cache (network or a bfcache blocker). Back-forward Cache means no network was needed because the in-memory history restore succeeded. That split is a practical way to see whether real users benefit from bfcache on your site.
What blocks bfcache: unload handlers, Cache-Control, and open connections
Section titled “What blocks bfcache: unload handlers, Cache-Control, and open connections”Pages can be refused entry to bfcache or evicted later for specification-mandated and implementation-specific reasons. Chrome’s field API and DevTools surface the same families of issues.
unload handlers and why Chrome deprecated unload
Section titled “unload handlers and why Chrome deprecated unload”Historically, registering an unload handler could prevent bfcache. Lighthouse summarizes the mechanism simply:
The back/forward cache (bfcache) stores a snapshot of the page in memory for when the page is restored from the navigation history. This significantly speeds up return navigations to the page, however some browser APIs (e.g. unload listeners) can cause the bfcache to fail and the page will be loaded normally.
— Google, Ensure the page can be restored from the back/forward cache
Chrome has completed deprecating the unload event by default: handlers no longer run unless a site explicitly opts back in. The team cites unreliability and bfcache conflict as core motives:
The unload event is extremely unreliable. On desktop Chrome and Firefox, unload is reasonably reliable but it has a negative impact on a site’s performance by preventing the usage of bfcache (back/forward cache).
— Google, Deprecating the unload event
For replacements, Chrome recommends visibilitychange (treat the hidden state as the last reliable time to persist data), pagehide (navigation away without making the page bfcache-ineligible), and limited, conditional beforeunload only when warning about unsaved changes. See Deprecating the unload event and Page Lifecycle API.
The notRestoredReasons API may still report unload-listener when unload is opted in; from Chrome 155 that reason is not emitted by default except for sites that re-enabled unload. Reason strings can change (for example unload-listener versus unload-handler in Chrome 123)—do not hard-code labels.
To discourage unexpected unload handlers (including from extensions), DevTools documentation recommends declaring Permissions-Policy: unload=() on responses. Details appear under Test back/forward cache.
Cache-Control: no-store and sensitive pages
Section titled “Cache-Control: no-store and sensitive pages”Cache-Control: no-store tells caches not to retain the response. Cloudflare’s cache concepts note that in many browsers no-store disables bfcache because restoring from bfcache requires keeping memory state, which conflicts with “do not store.”
Chrome has been rolling out a narrower rule: pages with no-store may enter bfcache when safe—for example when cookies and authorization have not changed—while still evicting on cookie changes or when certain APIs are in use (WebSocket, WebTransport, WebRTC, or subresource responses also marked no-store). The bfcache lifetime for those pages is reduced to three minutes. Other browsers may still block bfcache entirely on no-store; minimizing unnecessary no-store remains best practice. See Enabling bfcache for Cache-Control: no-store.
Other common blockers called out in Chrome docs include response-cache-control-no-store and related-active-contents (for example duplicate-tab scenarios). The list in Back/forward cache notRestoredReasons API is illustrative, not exhaustive.
notRestoredReasons: field diagnostics for blocked bfcache restores
Section titled “notRestoredReasons: field diagnostics for blocked bfcache restores”What the API returns and when to read it
Section titled “What the API returns and when to read it”The notRestoredReasons property on PerformanceNavigationTiming reports whether frames were blocked from using bfcache on history navigations and why:
The notRestoredReasons property, added to the PerformanceNavigationTiming class, reports information on whether frames present in the document were blocked from using the bfcache on navigation, and why. Developers can use this information to identify pages that need updates to make them bfcache-compatible, thereby improving site performance.
The API shipped from Chrome 123 (after an origin-trial iteration that used a boolean blocker and string reason arrays). Obtain entries via performance.getEntriesByType("navigation") or PerformanceObserver, then read navEntry.notRestoredReasons.
For history navigations the object includes children (nested same-origin frames), id, name, reasons, src, and url. For navigations that are not history traversals, notRestoredReasons is null. Importantly, null also appears when there are no blocking reasons—it does not by itself prove bfcache was used. For that, use the pageshow event’s persisted property as described in the Page Lifecycle API.
Same-origin iframes versus cross-origin masked reasons
Section titled “Same-origin iframes versus cross-origin masked reasons”Same-origin embedded frames appear under children with their own reasons. Cross-origin frames are privacy-limited: only information the parent already knows is exposed, and blocking in a cross-origin subtree surfaces as masked on the top-level frame’s reasons while the iframe’s own reasons may be null. masked can also reflect user-agent-specific cases, so it is not always attributable to your iframe. See Back/forward cache notRestoredReasons API.
Example pattern to log reasons in the field:
function logNotRestoredReasons() { const navEntries = performance.getEntriesByType("navigation"); for (const navEntry of navEntries) { console.log(navEntry.notRestoredReasons); }}Page Lifecycle events: pagehide, pageshow, and the frozen state
Section titled “Page Lifecycle events: pagehide, pageshow, and the frozen state”The Page Lifecycle API aligns DOM events with states such as hidden, frozen, and terminated. For bfcache work, two events matter most:
pagehide: fired when leaving a history entry. Ifevent.persistedistrue, the page is entering bfcache (conceptually the frozen state); iffalse, it is heading toward terminated.pageshow: fired when traversing session history—either a full load or a bfcache restore. When the page comes from bfcache,event.persistedistrue.
That persisted flag is the reliable complement to notRestoredReasons when you need to know whether a restore actually happened.
When a page moves to hidden, Chrome’s lifecycle guidance treats that as the practical end of a session for saving state and flushing analytics—more reliable than unload on mobile. When transitioning toward frozen, close connections that would block bfcache or leak resources across tabs (IndexedDB, BroadcastChannel, WebRTC, WebSockets, polling, Web Locks), and persist UI state you want after a possible discarded reload (document.wasDiscarded).
Side effects after more bfcache use: analytics, ads, and fresh data
Section titled “Side effects after more bfcache use: analytics, ads, and fresh data”Because bfcache restores revive the old JS heap instead of reloading, analytics and ads that only run on initial load may under-count. Chrome suggests listening for pageshow and sending another page view when event.persisted is true—for example with gtag('event', 'page_view'). The same pattern can refresh data or ads, weighing whether users expect to see exactly what they left. See Enabling bfcache for Cache-Control: no-store.
Local audits: Chrome DevTools and Lighthouse bfcache tests
Section titled “Local audits: Chrome DevTools and Lighthouse bfcache tests”DevTools Back/forward cache tab
Section titled “DevTools Back/forward cache tab”-
Open your page, then DevTools → Application → Background services → Back/forward cache (Test back/forward cache).
-
Click Test back/forward cache (Chrome navigates to
chrome://terms/and back) or use the browser back and forward buttons. -
If eligible, you should see “Successfully served from back/forward cache.” Otherwise expand issues classified as Actionable, Pending Support, or Not Actionable, and use the Frames section to see which frame blocked caching.
The same classification appears in Ensure the page can be restored from the back/forward cache. Actionable items are what you can fix (unload handlers, headers, and similar). Pending Support reflects Chrome limitations that may lift later. Not Actionable reflects constraints outside the page.
Lighthouse behavior in user flows
Section titled “Lighthouse behavior in user flows”Lighthouse actively exercises bfcache on a standalone navigation by leaving and returning through history. In user flows, it does not run that check on every navigation because it does not match typical journeys. You can still include a history step inside a timespan (navigate away, goBack(), end timespan) to surface bfcache failures. Puppeteer disables bfcache by default, so automated runs may not match real users. Details are in Ensure the page can be restored from the back/forward cache.
unload deprecation also points to the DevTools bfcache tester under Application for spotting unload handlers among actionable issues.
Common mistakes when chasing bfcache eligibility
Section titled “Common mistakes when chasing bfcache eligibility”| Mistake | Why it hurts | Better approach |
|---|---|---|
Using unload for saves or beacons |
Blocks or blocked bfcache; unreliable on mobile | visibilitychange to hidden, pagehide; remove unload or opt in only if unavoidable (Deprecating the unload event) |
Blanket Cache-Control: no-store on non-sensitive pages |
Often prevents bfcache; largest blocker class in Chrome metrics | Use no-cache or short max-age where appropriate; understand Chrome’s limited no-store bfcache rules (bfcache-ccns, Cloudflare cache concepts) |
| Open WebSockets or WebRTC while navigating away | Eviction or ineligibility, especially with no-store |
Tear down on pagehide/freeze; move extension sockets to background scripts (Page Lifecycle API, Web Store best practices) |
Treating notRestoredReasons === null as “used bfcache” |
null also means no blockers or non-history navigations |
Check pageshow event.persisted (notRestoredReasons API) |
| Hard-coding reason strings in dashboards | Chrome renames and adds reasons | Log full objects; handle unknown reasons gracefully |
How to check this on your site
Section titled “How to check this on your site”-
Run the Back/forward cache test in Chrome DevTools and fix Actionable findings, especially unload handlers and
Cache-Control: no-storeon pages that do not need them. -
Deploy a small
PerformanceObserveror RUM snippet that recordsPerformanceNavigationTiming.notRestoredReasonson history navigations, following Back/forward cache notRestoredReasons API. -
Confirm restores with
pageshowandevent.persisted, and adjust analytics or data refresh as in Enabling bfcache for Cache-Control: no-store. -
Optionally run the Lighthouse back/forward cache audit on a standalone navigation or a user-flow timespan that includes
goBack(). -
You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about so it can be corrected or explained.