Back/Forward Cache (bfcache)

The back/forward cache (bfcache) is a browser feature that preserves a complete page in memory, including its JavaScript state and DOM, when users leave it through a link. If they return with the back or forward button, the page is restored instantly, without a new network request and without reloading scripts. Chrome, Firefox and Safari now all support bfcache. Unlike classic browser caching through HTTP headers, bfcache does not cache individual resources but the complete rendered page state, including running scripts.

In practice

Many websites prevent bfcache unintentionally – most often through unload event listeners (a disqualifier in desktop Chrome and Firefox, but not on mobile), through open IndexedDB connections or in-flight fetch and XHR requests, through window.opener references, or through the header Cache-Control: no-store, the last of which often affects logged-in areas such as customer accounts or baskets. Open WebSocket connections no longer block bfcache in Chrome (from version 149) or Safari, but they still do in other browsers. With Chrome DevTools (the "Application" tab → "Back-forward cache" → "Run Test") you can check page by page what is blocking restoration. For agencies, a regular bfcache check is worthwhile, since a single analytics or chat script with an unload listener can disable the feature for a whole page on the desktop. Where possible, beforeunload handlers should only be set conditionally, for example only when there are unsaved form entries. A working bfcache improves above all the perceived speed of multi-page navigation flows such as category page to product page and back – an effect that classic lab measurements often underestimate.

Matching service

Sources

← Back to the glossary