Fix guides · Performance

How to fix “Page prevented back/forward cache restoration”

When visitors press Back, browsers can show the previous page instantly from memory, unless something on it opts out. The usual blockers and how to remove them.

Time to fix
15–60 minutes
Skill needed
Developer
Who notices
Every visitor who uses the Back and Forward buttons

Why it matters

The back/forward cache (bfcache) keeps a snapshot of a page in memory when a visitor navigates away. Pressing Back then shows it instantly, without loading anything again.

Some code makes a page ineligible: unload event listeners (often in old analytics or chat scripts), a Cache-Control: no-store header on the page, or open connections that can't be paused.

“The most important way to optimize for bfcache in all browsers is to never use the unload event. Ever!”

web.dev: Back/forward cache

Before you start

  • Your report lists the reasons the page couldn't be cached, grouped as actionable, pending browser support, or not actionable. Only the actionable ones are yours to fix.
  • unload listeners: replace them with pagehide. If they come from a third-party script, update or replace that script.
  • Cache-Control: no-store: keep it only for pages with private information (account pages, checkout). Use no-cache for pages that just need to be fresh.

Fix it on your platform

Shopify

  1. Check whether the blocking script belongs to an app (the report shows the file). Update or remove that app.
  2. If it's your theme's JavaScript, replace unload listeners with pagehide.

WordPress

  1. Check whether the blocking script belongs to a plugin. Update it, or replace it with one that doesn't use unload.
  2. Some caching or security plugins send Cache-Control: no-store on every page. Limit that to logged-in or account pages if the plugin allows.

Webflow

  1. Webflow's own scripts are managed by Webflow. If the blocker is in your custom code or an embed, replace unload listeners with pagehide or remove the script.

Wix Managed by the platform

  1. Wix manages its own pages and headers. If an app or your custom code is listed as the cause, remove or update it.

Squarespace Managed by the platform

  1. Squarespace manages its own pages and headers. If code injection or an extension is listed as the cause, remove or update it.

Next.js

  1. Next.js sends Cache-Control: no-store on dynamically rendered pages, which can keep them out of the bfcache. Render pages statically, or cache them, where their content allows.
  2. Replace unload listeners in your code with pagehide.

Any other site

  1. Replace unload listeners with pagehide.
  2. Don't send Cache-Control: no-store on pages without private information.
  3. Close open connections (WebSocket, IndexedDB transactions) in pagehide and reopen them in pageshow.
pagehide instead of unload
window.addEventListener("pagehide", () => {
  navigator.sendBeacon("/analytics", JSON.stringify(stats));
});

Check that it's fixed

  • In Chrome DevTools, open Application → Back-forward Cache and click Run Test. It reports whether the page was restored, and why not.
  • Re-run your StudioLNC audit: the issue should be gone, or list only reasons you can't act on.

Find every issue like this on your site

Free audit of performance, accessibility, SEO and security, with fixes for your platform.