Mechanical ComparisonBack/Forward Cache (bfcache): Baseline · WidelyHTTP Caching Directives: Baseline · Widely

Back/Forward Cache (bfcache) vs HTTP Caching Directives

Mechanical Verdict

Disk cache stores raw HTTP bytes; no-store disables both disk cache and in-memory bfcache.

Try Back/Forward Cache (bfcache) LabTry HTTP Caching Directives LabRead Back/Forward Cache (bfcache) DissectionRead HTTP Caching Directives Dissection

Structured Comparison Matrix

DimensionBack/Forward Cache (bfcache)HTTP Caching Directives
Mental ModelIn-memory cache snapshotting the full JS heap and DOM tree on outbound navigation to restore the page instantaneously on Back/Forward.Controls disk and shared cache reuse via Cache-Control, ETag, and Vary headers—separating immutable hashed assets from revalidated HTML documents.
Maturity & DomainBaseline · Widely · Network & Performance
Chrome 96+ · Firefox 1.5+ · Safari 1+
Baseline · Widely · Network & Performance
Chrome 66+ · Firefox 49+ · Safari 11+
PrerequisitesFoundational primitive
When Not to UseWhen not to use bfcache: On banking or authenticated views displaying sensitive data after logout, enforce Cache-Control: no-store or clear sensitive DOM on pagehide.When not to use immutable: Never attach immutable to unhashed URLs like /app.js or /avatar.png, users stay stuck on stale bytes until they clear site data.

Engine Mechanics & Trade-Offs

Back/Forward Cache (bfcache)Baseline · Widely

Full JS heap and DOM tree preserved in RAM.

Key Pitfalls: unload listener in a third-party script: A single window.addEventListener('unload', ...) disables bfcache across the entire site. Stale state on return: A shopping cart or CSRF token restored from bfcache remains frozen; listen to pageshow (if (e.persisted)) to refresh volatile data.

HTTP Caching DirectivesBaseline · Widely

Evaluates Cache-Control freshness lifetimes and ETag validators before issuing network bytes, controlling disk cache reuse and bfcache eligibility.

Key Pitfalls: no-cache vs no-store confusion: no-cache still caches the response and revalidates; no-store forbids all storage and kills bfcache site-wide. Missing Vary on content negotiation: Serving WebP and JPEG at the same URL without Vary: Accept poisons CDN Edge Cache Keys for unsupported browsers.

Seen in Architecture Autopsies