# Make pages eligible for the back/forward cache (bfcache)

- Check 06.26 · Performance and Core Web Vitals · Important
- Source: https://checklist-seo-geo.com/en/performance-core-web-vitals/make-pages-eligible-bfcache
- Test whether your pages are eligible for the back/forward cache (bfcache), remove the blockers (unload, no-store, open connections) and measure the result.
- Updated on 2026-11-27
- Licence: CC BY 4.0. Credit “Checklist SEO & GEO” with a link to https://checklist-seo-geo.com/en/performance-core-web-vitals/make-pages-eligible-bfcache.
- Plugin checklist-seo-geo: 1.3.1 · https://github.com/maximegaul/checklist-seo-geo

## In short

The bfcache (back/forward cache) keeps an entire page in memory, JavaScript state included, when the visitor leaves it. If they come back with the Back or Forward button, the browser restores it as it was, with no request and no rendering. Chrome, Firefox and Safari all have one. The work consists of checking that nothing in your pages prevents them from being stored this way, then handling the restore correctly.

## Why it matters

The HTTP cache only stores responses: on a back navigation, the browser still has to re-read the HTML, run the scripts again and repaint the page. The bfcache, by contrast, freezes the complete page and suspends its JavaScript. The restore is almost instant, and the visitor gets back their scroll position and the fields they had filled in.

It is a common case: product list, product page, back to the list; internal search results, article, back. But the browser only uses it if it considers the operation safe. Several things prevent it, depending on the browser:

| Cause | Status as of November 2026 |
|---|---|
| `unload` event handler | Chrome no longer fires `unload` by default now that its deprecation is complete (100% of page loads from Chrome 155). Firefox, for its part, long excluded pages that listen for it: stop using it |
| `Cache-Control: no-store` on the document | Blocking by default. Chrome now restores these pages when it considers it safe (no cookie change in the meantime, in particular), with a shorter retention time. Other browsers may keep blocking |
| Open connections (IndexedDB, `fetch()` in progress, WebSocket, WebRTC) | Varies by browser and API: close them when the page is left |
| Non-null `window.opener` | Page opened by `window.open()` or a link without `noopener`: can block the page and the one that opened it |
| Iframe that uses a blocking API | Also blocks the page that embeds it |

These rules change from one version to the next: rely on the test described below and on the web.dev and Chrome pages linked at the bottom of this guide rather than on a fixed list.

> **Good to know:** in a single-page application, route changes handled by the JavaScript router do not go through the bfcache. It only concerns navigations handled by the browser.

## What it improves

- **Back and forward navigations**: instant display, with no network request.
- **Core Web Vitals**: these restores count in Chrome's field data, with a very short LCP (Largest Contentful Paint, rendering of the largest visible element). CrUX distinguishes navigation types, which lets you see their share.
- **Server load**: a restore requests no document from the server.
- **Rankings**: indirect and modest effect, through Core Web Vitals, one signal among many others. Crawlers do not navigate back.
- **Analytics**: be careful, a restore does not reload the page. Without adaptation, some tools do not count that page view.

## How to check

In Chrome, open DevTools, `Application` panel, `Background services > Back/forward cache` section, then click `Test back/forward cache`. Chrome leaves the page and then comes back to it. Compliant result: “Successfully served from back/forward cache”. Otherwise, the reasons are sorted into three groups:

- `Actionable`: to be fixed in the page (for example an `unload` handler);
- `Pending Support`: a feature that Chrome cannot cache yet;
- `Not Actionable`: a cause outside the page.

The `Frames` section shows which iframe is responsible. Test one template of each type, logged in and logged out, and without browser extensions (guest profile): an extension can skew the result.

Check the document's header too:

```bash
curl -s -o /dev/null -D - https://example.com/ | grep -i "cache-control"
```

A response that contains `no-store` needs a closer look. Lighthouse also has an audit dedicated to the bfcache: see [analyze PageSpeed Insights and Lighthouse](https://checklist-seo-geo.com/en/performance-core-web-vitals/analyze-pagespeed-insights-lighthouse).

Finally, check in Firefox and Safari: navigate, go back, and see whether this code logs `true`.

```js
window.addEventListener('pageshow', (event) => {
  console.log('Restored from the bfcache:', event.persisted);
});
```

## How to implement

### Replace unload with pagehide

Search for `unload` in your code and in the code of the libraries you ship (`addEventListener('unload'`, `window.onunload`). Replace it with `pagehide`, or with `visibilitychange` to send analytics data: it is the last reliable moment on mobile.

```js
window.addEventListener('pagehide', (event) => {
  fermerConnexions();
});

document.addEventListener('visibilitychange', () => {
  if (document.visibilityState === 'hidden') {
    navigator.sendBeacon('/mesure', JSON.stringify(donnees));
  }
});
```

Only add `beforeunload` when there really are unsaved changes, and remove it as soon as they are saved.

Third-party scripts are often the culprits. The `Permissions-Policy: unload=()` header forbids any `unload` handler in the page and its iframes. It is only recognized by Chromium browsers, where it has become the default behavior: it is now only useful for earlier versions of Chrome. For other browsers, the only solution is still to remove or replace the script. See [limit third-party scripts](https://checklist-seo-geo.com/en/performance-core-web-vitals/limit-third-party-scripts).

### Keep no-store for the pages that require it

`no-store` is justified for genuinely sensitive pages (bank account, medical record). For a page that simply has to stay up to date, `Cache-Control: no-cache` or `max-age=0` is enough: the browser revalidates with the server on every load, without giving up the bfcache. See [configure browser and server caching](https://checklist-seo-geo.com/en/performance-core-web-vitals/configure-browser-server-caching).

### Close connections and reopen them on return

```js
let canal = ouvrirWebSocket();

window.addEventListener('pagehide', () => {
  canal.close();
});

window.addEventListener('pageshow', (event) => {
  if (event.persisted) {
    canal = ouvrirWebSocket();
  }
});
```

Do the same for IndexedDB connections and abort long-running `fetch()` requests. Add `rel="noopener"` to links that open a new window if your templates target old browsers.

### Refresh what may have changed

A restored page shows the state it had before the visitor left. Update whatever depends on the session when `pageshow` fires:

```js
window.addEventListener('pageshow', (event) => {
  if (! event.persisted) {
    return;
  }

  actualiserCompteurPanier();

  if (! document.cookie.includes('session_active=')) {
    location.reload();
  }
});
```

The cookie test assumes a cookie readable in JavaScript, set at login and deleted at logout: adapt its name. For analytics, send a page view in this same handler if your tool does not do it: see [set up GA4, Matomo or an equivalent](https://checklist-seo-geo.com/en/tracking-analytics-setup/set-up-ga4-matomo-equivalent). Ad slots are refreshed in the same way.

### Measure in the field

The `notRestoredReasons` API gives, for a back or forward navigation that did not use the bfcache, the list of reasons, iframes included. It has been available in Chrome since version 123; check the other browsers on MDN.

```js
window.addEventListener('pageshow', (event) => {
  const navigation = performance.getEntriesByType('navigation')[0];

  const mesure = {
    page: location.pathname,
    type: event.persisted ? 'back_forward_cache' : navigation.type,
    motifs: [],
  };

  if (! event.persisted && navigation.type === 'back_forward') {
    mesure.motifs = (navigation.notRestoredReasons?.reasons ?? []).map((motif) => motif.reason);
  }

  navigator.sendBeacon('/rum', JSON.stringify(mesure));
});
```

The hit rate is calculated as follows: `back_forward_cache` restores divided by the total of `back_forward_cache` + `back_forward`. Do not expect 100%: a duplicated tab, a closed browser or an expired timeout make some restores fail. The reason labels change between Chrome versions: group them without hard-coding them.

### Apache

Versions: Apache 2.4 (mod_headers).

First find where `no-store` is added:

```bash
grep -R -n -i "no-store" /etc/apache2/ /var/www/example/.htaccess
```

If the directive comes from Apache and targets public pages, replace it, in the virtual host or the `.htaccess`:

```apache
<IfModule mod_headers.c>
    Header set Cache-Control "no-cache" "expr=%{CONTENT_TYPE} =~ m#text/html#i"
    Header set Permissions-Policy "unload=()"
</IfModule>
```

The first line replaces the header on all HTML: restrict it with a `<LocationMatch>` block if some pages must keep `no-store`. If the `Permissions-Policy` header already exists, add `unload=()` to its value instead of creating a second one. Reload with `sudo apachectl configtest && sudo systemctl reload apache2`.

### Nginx

Versions: Nginx 1.18 and later.

```bash
grep -R -n -i "no-store" /etc/nginx/
```

In the `location` block that serves the HTML:

```nginx
add_header Cache-Control "no-cache";
add_header Permissions-Policy "unload=()";
```

If the `Cache-Control` header comes from the application (PHP, Node.js), fix it in the application: `add_header` would add a second header instead of replacing the first. Reload with `sudo nginx -t && sudo systemctl reload nginx`.

### Cloudflare

Versions: Cloudflare dashboard, all plans, November 2026.

Cloudflare passes the origin's `Cache-Control` header on to the browser. If you cannot fix the origin, a response header transform rule can rewrite it or add `Permissions-Policy`: `Rules > Overview` ([rules overview](https://dash.cloudflare.com/?to=/:account/:zone/rules/overview)). Limit the rule to public pages and test again in DevTools.

### WordPress

Versions: WordPress 6.8 and later.

Public pages viewed by a logged-out visitor do not get `no-store` from core. However, all “nocache” responses have carried it since WordPress 6.8: the admin, logged-in users, and the pages that plugins declare non-cacheable (cart, checkout and account of a store). On those pages, back navigation therefore depends on the browser.

- A core ticket proposes making the bfcache possible for logged-in users; the Instant Back/Forward plugin applies this approach. Check their status before installing anything.
- Test the site with plugins active: live chat, advertising and old jQuery libraries add `unload` handlers. The DevTools test names the script responsible.
- A caching plugin changes nothing for the bfcache: it all happens in the browser.

### Laravel

Versions: Laravel 11 to 13.

Out of the box, a Laravel response is sent with `Cache-Control: no-cache, private`, which is compatible with the bfcache. Look for what adds `no-store`:

```bash
grep -R -n "no-store\|no_store" app/ config/ routes/
```

A security middleware or a third-party package sometimes applies it to every route: limit it to sensitive pages. After a logout, handle back navigation with the `pageshow` handler above.

### Next.js

Versions: Next.js 15 and 16 (App Router).

Internal navigations go through the client-side router and do not involve the bfcache. It comes into play when the visitor leaves the site and then comes back with the Back button. In that case, check the document's header with `curl`: depending on the route's rendering mode (static or on demand), Next.js does not send the same `Cache-Control`. If an on-demand route responds with `no-store` for no reason, see whether it can be rendered statically or revalidated; the Next.js caching documentation describes both cases.

## Common mistakes

- **Setting `no-store` everywhere “for security”**: public pages lose the bfcache in some browsers, with nothing protected in return.
- **Testing with your extensions active**: they inject their own scripts and skew the diagnosis.
- **Testing only in Chrome**: Chrome has become the most lenient (`unload`, `no-store`). A page that passes in Chrome may still be blocked elsewhere.
- **Forgetting stale state**: cart, login status or stock shown as they were when the visitor left. Refresh them on `pageshow`.
- **Reading `notRestoredReasons` as proof of a restore**: a null value does not mean the bfcache was used. Only `event.persisted` tells you that.
- **Believing that `pagehide` with `persisted` set to `true` guarantees caching**: the browser intends to keep the page, but is under no obligation to.
- **Confusing it with preloading**: the bfcache only handles returns. For forward navigations, see [preload navigations with Speculation Rules](https://checklist-seo-geo.com/en/performance-core-web-vitals/preload-likely-navigations-speculation-rules).

## Frequently asked questions

### What is the difference between the bfcache and the HTTP cache?

The HTTP cache keeps network responses: HTML, CSS, images. On a back navigation, the browser still has to parse the HTML, run the scripts and repaint the page. The bfcache keeps the whole page in memory, JavaScript state and scroll position included, and restores it with no request and no rendering. The two are independent: a page can be absent from the HTTP cache and present in the bfcache.

### Does Cache-Control: no-store always prevent the bfcache?

Not always any more. Historically, a document served with Cache-Control: no-store was excluded from the bfcache. Chrome now restores these pages when it considers it safe, for example if cookies have not changed since the visitor left, and keeps them for a shorter time. Other browsers may keep excluding them. For a public page that has to stay up to date, prefer no-cache or max-age=0.

### Does the bfcache improve SEO?

Indirectly and modestly. Restores from the bfcache are counted in Chrome's field data with very short display times, which improves the site's Core Web Vitals. These are one ranking signal among many others. Crawlers do not go back: the benefit is first and foremost for visitors, on round trips between listing pages and detail pages.

### How do I find out why a page is not stored in the bfcache?

In Chrome, open DevTools, Application panel, Back/forward cache section, and run the test: the reasons are displayed, sorted by whether or not you can fix them, along with the iframe responsible. In the field, the notRestoredReasons property of the navigation entry gives the same reasons for real visits, in the browsers that support it.

### Are page views counted when a page is restored?

Not necessarily. A restore from the bfcache does not reload the page: scripts do not run again, and an analytics tool that sends the page view on load sees nothing. Listen for the pageshow event and, when event.persisted is true, send the page view yourself if your tool does not do it. Check its documentation to avoid double counting.

## Resources

- [web.dev: Back/forward cache (bfcache)](https://web.dev/articles/bfcache)
- [Chrome DevTools: Test back/forward cache](https://developer.chrome.com/docs/devtools/application/back-forward-cache)
- [Chrome for Developers: notRestoredReasons API](https://developer.chrome.com/docs/web-platform/bfcache-notrestoredreasons)
- [Chrome for Developers: bfcache and `Cache-Control: no-store`](https://developer.chrome.com/docs/web-platform/bfcache-ccns)
- [Chrome for Developers: Deprecating the unload event](https://developer.chrome.com/docs/web-platform/deprecating-unload)
- [MDN: Permissions-Policy `unload` directive](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Permissions-Policy/unload)
- [WordPress: `wp_get_nocache_headers()` function](https://developer.wordpress.org/reference/functions/wp_get_nocache_headers/) and [ticket 63636 on the bfcache](https://core.trac.wordpress.org/ticket/63636)
- [Next.js: Caching](https://nextjs.org/docs/app/building-your-application/caching)

Next steps: [preload navigations with Speculation Rules](https://checklist-seo-geo.com/en/performance-core-web-vitals/preload-likely-navigations-speculation-rules), [configure browser and server caching](https://checklist-seo-geo.com/en/performance-core-web-vitals/configure-browser-server-caching) and [analyze real-user CrUX data](https://checklist-seo-geo.com/en/performance-core-web-vitals/analyze-real-user-crux-data).
