Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
thedaviddias avatar

Back Forward Cache

  • 1 installs
  • 73.4k repo stars
  • Updated June 18, 2026
  • thedaviddias/frontendchecklist

Removes bfcache blockers like unload listeners and moves lifecycle logic to pagehide and pageshow so back/forward navigations restore instantly.

About

A frontend-checklist performance rule for keeping pages eligible for the browser back/forward cache. A developer uses it when back and forward navigations feel slow because the page is rebuilt instead of resumed.

  • Never add an unload listener - it blocks bfcache
  • Use pagehide/pageshow and refresh state when persisted is true

Back Forward Cache by the numbers

  • 1 all-time installs (skills.sh)
  • Ranked #1,914 of 2,245 Frontend Development skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/thedaviddias/frontendchecklist --skill back-forward-cache

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1
repo stars73.4k
Last updatedJune 18, 2026
Repositorythedaviddias/frontendchecklist

What it does

Removes bfcache blockers like unload listeners and moves lifecycle logic to pagehide and pageshow so back/forward navigations restore instantly.

Files

SKILL.mdMarkdownGitHub ↗

Optimize pages for back/forward cache

Back/forward cache turns many browser back and forward navigations into near-instant restores because the entire page is resumed from memory instead of being rebuilt from the network. Losing bfcache eligibility makes common navigations feel far slower than they need to.

Quick Reference

  • Never add an unload listener - it is the most common bfcache blocker
  • Use pagehide and pageshow instead of assuming every navigation reloads
  • Refresh time-sensitive state when pageshow.persisted is true
  • Keep beforeunload conditional and remove it when there are no unsaved changes
  • Verify eligibility in DevTools instead of assuming a page is cacheable

Check

Review this route for back/forward cache blockers. Search for unload or unconditional beforeunload listeners, state that assumes every navigation is a full reload, and resource lifecycles that break when the page is resumed from memory.

Fix

Replace unload logic with pagehide and pageshow handlers, remove unnecessary blockers, and refresh only the time-sensitive state that must change after a bfcache restore.

Explain

Explain how the back/forward cache differs from HTTP caching, why unload blocks it, and how pageshow/pagehide should be used instead.

Code Review

Review route code, global listeners, analytics hooks, and data-refresh logic related to Optimize pages for back/forward cache. Flag exact listeners, APIs, or lifecycle assumptions that prevent a restore or leave stale state after a restore.

---

For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/en/rules/performance/back-forward-cache

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.