Core Web Vitals

Test bfcache eligibility and a working return journey

A practical workflow for diagnosing bfcache misses and validating the page that users return to.

A browser window connects to a cached page card through two curved arrows, with a small checklist beside them.

Test bfcache with a real journey away from a page and back, then confirm restoration with pageshow.persisted. A fast reload is not proof that the browser restored the previous document, and a successful restoration is only useful if the page still works correctly.

Define the journey before changing code

Back/forward cache, usually called bfcache, lets a browser preserve a page for possible reuse during history navigation. It is different from the HTTP cache that reuses downloaded resources. When restoration succeeds, the browser resumes an existing document rather than rebuilding the page from its files. Eligibility therefore involves the page's behavior as well as its resources.

Choose one representative route through the site. For example, open a results page, select a detail page and use the browser's Back button to return. Record the exact starting URL, browser version, authentication state and actions performed before leaving. Treat this as a proposed test procedure, not a benchmark with an assumed result.

Include a useful state change before navigation: select a filter, scroll to a particular result or enter a harmless draft. This gives the return visit something meaningful to preserve. A blank page that passes a synthetic navigation tells you little about a customer's partially completed task or a dashboard with active connections.

Keep reloads and history visits in separate rows of your test record. A normal reload remains valuable for understanding the first-load experience, but it answers another question. The same distinction belongs in your performance investigation: optimizing return navigation does not remove the need to diagnose slow initial rendering or unresponsive interactions.

Run the browser test and capture its explanation

In Chrome DevTools, open Application, find Back/forward cache under Background services and run its test. The tool navigates away and returns, reporting either restoration or issues that prevented it. The official DevTools bfcache testing instructions explain the current interface and the frame details available for failures.

Save the result alongside the route and browser version. Expand the frame information when an embedded document is involved, and distinguish your own code from a third-party component. “The page failed” is not a useful engineering ticket unless another person can reproduce the navigation and identify which reported condition needs investigation.

Repeat the manual journey with normal browser Back and Forward controls. This complements the tool's controlled navigation with the actual sequence your application exposes. A browser extension, login state or different embedded content can change the environment, so document those differences instead of treating conflicting results as interchangeable evidence.

Run relevant journeys in the browsers your audience uses. A Chrome result establishes what happened in that tested environment; it does not certify Firefox, Safari or every mobile browser. Preserve failures as well as successes. A browser choosing not to retain a page is not automatically a defect your application can eliminate.

Observe restoration without creating a new blocker

Add a small diagnostic listener in a development build or a controlled test environment. Install it before navigating away, and preserve the console log during the journey. The following JavaScript records whether a pageshow event represents restoration. It does not send analytics, refresh data or change application state.

js
window.addEventListener("pageshow", (event) => {
  console.info("history-return-check", {
    restoredFromBfcache: event.persisted,
    path: window.location.pathname
  });
});

The event also occurs on ordinary page loads, so listening for pageshow alone is insufficient. Its persisted value is the important distinction. Do not interpret the event name as proof that a person saw the page: documents can also be opened in background tabs or involved in prerendering.

The related pagehide event can help examine departure. A true persisted value there describes the browser's intention to retain the page, not a promise that it will later restore it. Keep the departure observation and the return observation separate. Otherwise, a report can incorrectly count attempted retention as a successful user return.

Avoid adding an unload listener as a debugging shortcut. MDN warns that this event is unreliable and can interfere with bfcache eligibility in browsers such as Firefox. pagehide is compatible with bfcache, but it is not guaranteed to run in every mobile termination scenario. Important data should not depend solely on a last-second callback.

Investigate the reported reason, not an old checklist

Start with the reason produced by the tested browser and version. Search for the relevant listener, connection or embedded frame, then assign a specific owner. Removing an unused dependency is a different change from redesigning an active connection's lifecycle. Make one bounded change and repeat the same journey before combining it with unrelated performance work.

Where supported, PerformanceNavigationTiming.notRestoredReasons can provide additional information about a history navigation that was not restored. Check feature availability before using it. A missing property and a returned null are different situations, and null does not establish that restoration succeeded. Keep pageshow.persisted as the explicit return signal.

Do not delete Cache-Control: no-store simply to obtain a green test. Chrome permits some such pages to use bfcache under defined conditions, while other browsers can behave differently. A header protecting sensitive information requires a security and freshness decision. Test logout and authorization changes rather than assuming a cache directive alone determines the entire outcome.

Likewise, if an open resource is implicated, design both sides of its lifecycle. Closing a connection when leaving is only half the work; the returned page must reconnect safely when needed. Ensure that multiple lifecycle handlers cannot create duplicate connections. Use the reported problem to guide the change, not a blanket rule that every open connection is always disqualifying.

Check that the restored page is still correct

Use a small state matrix to separate restoration from correctness. These are proposed checks, not observations from a tested site. Choose harmless test data and an account intended for testing. Record the visible result and any server-side validation separately, especially when the page contains information that can change while it is away.

State before leaving Check after returning
A selected filter and scrolled results Selection and useful position remain understandable
An unfinished non-sensitive form Draft and validation behavior match the product's policy
A signed-in page followed by logout elsewhere Protected data and actions respect the current session
A changing availability or status display The interface handles stale information deliberately
A page with an active connection Reconnection happens without duplicate subscriptions

Do not refresh every restored document indiscriminately. A full reload can throw away the very task the visitor wanted to resume. Identify which information needs revalidation, which local state should remain, and how the interface will explain a change. That decision belongs to the product's data model, not to the cache test alone.

For a form, distinguish displaying an existing draft from submitting it. Returning to the page should not silently repeat a purchase, send a message or replay another consequential action. Verify that the next explicit user action still reaches the appropriate server-side checks. A responsive restored interface is not a substitute for current authorization.

Check focus and visible context as well as data. A restored page should give a keyboard user a coherent next step and should not conceal an important updated message. If a resumed component introduces a jump or a long task, investigate that behavior directly. Restoration success and the quality of subsequent interactions are separate acceptance criteria.

Keep restoration metrics separate from reload measurements

Review your analytics implementation before adding a second page-view event. Some measurement systems already handle bfcache returns; others need explicit support. Decide how a restored visit should appear, then inspect the existing collection path so the same return is not counted twice. Keep consent and data minimization requirements unchanged.

Segment observations by navigation type when comparing performance. A change in the share of restored visits can alter the population behind a report without making every ordinary load faster. Preserve the denominator and the collection method in your notes. Avoid publishing a percentage improvement from a handful of manual tests or comparing unlike groups. The distinction between field data and lab data helps keep the scope of each observation clear.

A perfect restoration rate is not a sensible release promise. Browsers can discard retained pages, and actions such as restarting a browser or reopening a tab do not provide the same conditions as a direct history return. Treat unexplained misses as investigation leads while keeping expected environmental limits visible in the results.

Make the check repeatable before release

Keep a short record for each important journey: browser and version, route, initial state, actions, restoration signal, reported blocking reasons and the result of the state checks. Store the record with the change that addressed the problem. This makes a later regression easier to distinguish from a different browser or application configuration.

Repeat the checks after changing authentication, analytics, embedded content or connection management. These areas can affect what happens when a document leaves and returns, even if the visible design stays the same. Include the normal load and the restored return in review, and let the team inspect failures before expanding a fix across templates.

Ship when the intended journeys restore where the browser permits it, the page remains correct, and the measurement does not confuse restoration with a reload. Keep unresolved browser-specific limits documented. The useful outcome is a reliable return to the visitor's task, supported by reproducible evidence rather than a single green panel.

Related guides