Browser Back Button Shows Stale Cart/Auth State (Back/Forward Cache `bfcache`)
Modern browsers restore full JS heap snapshots from `bfcache` without firing `DOMContentLoaded`.
Runs locally in browser
Free · No login
Independently Verified 2026-11-25
v4.1.0
Identifier: Browser Back Button Shows Stale Cart/Auth State (Back/Forward Cache `bfcache`)
Platform: Web
Common Root Causes:
- Modern browsers restore full JS heap snapshots from `bfcache` without firing `DOMContentLoaded`.
Interactive Diagnostic Checklist
Verified Solutions:
- Refresh dynamic state inside `pageshow` when `event.persisted === true`.
Safe Diagnostic Command:
Listen for `window.addEventListener("pageshow", e => e.persisted)`Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.
Technical Explanation
Modern browsers restore full JS heap snapshots from `bfcache` without firing `DOMContentLoaded`. Recommended diagnostic: `Listen for `window.addEventListener("pageshow", e => e.persisted)``. Remediation: Refresh dynamic state inside `pageshow` when `event.persisted === true`.
Worked Examples
- Run `Listen for `window.addEventListener("pageshow", e => e.persisted)`` to verify root cause before applying the remediation.
Limitations & Assumptions
- Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.
Source References & Verification
Resource ID: err-browser-bfcache-stale-state · Independently verified: 2026-11-25