# Optimize Pages for Back/Forward Cache

Improve navigation performance by enabling browser back/forward cache, which restores pages from memory instead of rebuilding them from the network. The deliverable is a page that is eligible for back/forward cache restoration, ensuring faster navigation and reduced network requests.

**Canonical URL:** https://skillshunter.net/skills/github-thedaviddias-front-end-checklist-skills-back-forward-cache-a1db4576a6be

**JSON URL:** https://skillshunter.net/api/public/v1/skills/github-thedaviddias-front-end-checklist-skills-back-forward-cache-a1db4576a6be

**Markdown URL:** https://skillshunter.net/skills/github-thedaviddias-front-end-checklist-skills-back-forward-cache-a1db4576a6be.md

**Instructions download URL:** https://skillshunter.net/skills/github-thedaviddias-front-end-checklist-skills-back-forward-cache-a1db4576a6be/download

**Category:** Software & Development

**Source URL:** https://github.com/thedaviddias/Front-End-Checklist/blob/e8d14d049010e2ce25afcd5e8609dfcbbe63e47e/skills/back-forward-cache/SKILL.md

**Source commit:** e8d14d049010e2ce25afcd5e8609dfcbbe63e47e

**Listing approved at:** 2026-11-23

**Created at:** 2026-11-22T15:22:31.000000Z

**Updated at:** 2026-11-23T04:54:44.000000Z

## Catalog information

The following descriptions are catalog information. Listing approval does not mean the skill has been tested or is safe for every environment.

### Editor's note

Verify eligibility in DevTools instead of assuming a page is cacheable. Ensure `pagehide` and `pageshow` are used for lifecycle management, and avoid unconditional `beforeunload` listeners.

### When to use it

- Enhance user experience by making common navigations faster
- Avoid unnecessary network requests during back/forward navigation
- Ensure state is correctly refreshed after a bfcache restore

## Skill instructions

---
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

