Skip to content
Skillpedia
Websites & UI (frontend)75k · #2754

back-forward-cache

What it does

This skill checks pages for code that stops the browser from saving them for instant back and forward navigation. It is for developers who want faster returns to pages within a site.

When to use it

  • ✓When pages reload slowly after a visitor clicks back.
  • ✓When a page uses unload listeners or a beforeunload prompt that always runs.
  • ✓When time-sensitive data should refresh after the page is restored.

Skill link

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/back-forward-cache/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/back-forward-cache/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Check my checkout pages for anything that stops back navigation from being instant.”

5 new skills a week. 1 minute to read.

How it works

The agent looks for unload listeners and unconditional beforeunload handlers, moves that logic to pagehide and pageshow, and refreshes only the data that must change.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

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/rules/performance/back-forward-cache

FAQ

What is the back and forward cache?

The skill describes it as keeping the whole page in memory so it can resume quickly, instead of rebuilding it from the network.

What blocks it most often?

The skill says an unload listener is the most common blocker.

How can I confirm a page is eligible?

The skill says to verify eligibility in the browser developer tools.

Details

Original description by the author

Use when reviewing navigation performance, browser lifecycle events, or resume-from-memory behavior. Check the actual browser lifecycle and restore path, not only static code patterns.

repo: thedaviddias/Front-End-Checklist

Popularity

GitHub stars
75k
Ranking position
#2754
License
MIT
Updated
10/31/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills