Deutsch
Optimization

Back/forward cache

Also known as: bfcache

The back/forward cache (bfcache) is a browser optimization that keeps a complete snapshot of a page in memory when a user navigates away. If the user presses Back or Forward, the browser restores the page instead of loading it again.

How does it differ from the HTTP cache?

The HTTP cache stores individual responses. The bfcache stores the whole page, including the JavaScript heap, with running code paused. According to web.dev, a bfcache restore is essentially instant. It is a browser feature and not a ranking factor, but web.dev notes that restores can improve Core Web Vitals in field data.

What blocks the bfcache?

web.dev and MDN name these common blockers:

  • an unload event listener, so use pagehide instead
  • open connections such as WebSocket or in-flight fetch requests
  • open IndexedDB transactions
  • Cache-Control: no-store on the page. Chrome allows bfcache for such pages under conditions, for example when cookies do not change. Its documentation describes the final rollout to all users in March and April 2025.

Example

In Chrome DevTools, open Application, then Back/forward cache, and run the test. It reports either success or the reason the page was not restored. In code, the persisted property shows a restore:

JavaScript
window.addEventListener('pageshow', (event) => {
  if (event.persisted) {
    // page was restored from the bfcache
  }
});

Pages restored this way do not fire a normal load, which matters for analytics. The notRestoredReasons API reports blockers from real visits.

Sources

  1. Back/forward cache – web.devweb.dev
  2. bfcache – MDN Web Docs Glossarydeveloper.mozilla.org
  3. Chrome: bfcache for Cache-Control: no-store pages – Chrome for Developersdeveloper.chrome.com

Last updated: