Skip to content
Back to skills

Back Forward Cache

ASecurity

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.

  • 74,358 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 5, 2026
developmentgoapifrontendperformance

Works with

  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned October 5, 2026

npx -y skills add thedaviddias/Front-End-Checklist --skill back-forward-cache --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Back Forward Cache?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Back Forward Cache
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/thedaviddias-back-forward-cache/badge)](https://www.skillsdirectory.com/skills/thedaviddias-back-forward-cache)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: back-forward-cache
description: "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."
metadata:
  category: performance
  priority: high
  difficulty: advanced
  estimatedTime: "25"
  source: frontendchecklist.io
  url: https://frontendchecklist.io/rules/performance/back-forward-cache
---

# 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

Files in this skill

  • SKILL.md2.1 KB
  • references/rule.md4.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…