concept Frontend & browsers
Back-forward cache versus actual reload
Back can restore the document you left, including its JavaScript state. Reload starts a new document. Compare the two with an in-memory counter, then see what the pageshow event tells you on a real return.
What it means
Back can return you to the same document you left, with its JavaScript state still in memory. That is a restoration from the back-forward cache (bfcache). A reload starts a new document at the same address. Back can also result in a new document if the browser no longer has the old one. The address alone does not tell you which happened.
Try it
Simulation: Page A has a counter that starts at 0 and has reached 7. Compare two ways of seeing A again: visiting page B and going back to A, or reloading A while you are on it.
Back-forward cache versus actual reload
Explain restored documents versus new load and effects on page state
Prior document is restored; its stipulated in-memory state remains.
Navigation
- Navigationback
- Eligibilityyes
- Previous counter7
Result
- Outcomerestore
- Counter after navigation7
The counter illustrates one retained value. A reload is not a back-forward-cache restoration; no actual browser eligibility is tested.
Evaluated inputs
- Required scenario evidence
- provided
- Navigation
- back
- Prior document available for bfcache
- yes
- Prior in-memory counter
- 7 count
Stipulated bfcache eligibility and one counter, no actual navigation, network cache or browser-specific eligibility rules.
About this model
The controls set only a local, bounded scenario. The computed branch is not a verdict about a live system. Inputs listed as not evaluated did not participate in this branch after validation.
Reset restores the original inputs. It does not change the open or closed state of help or FAQ answers.
- Start with
Navigationset toback,Prior document available for bfcacheset toyes, and scenario evidenceprovided. The result isrestore: you get the original A back, so its counter is still 7. - Change only
Navigationtoreload. The result isnew, with a count of 0. Even thoughyesand 7 are still selected, neither the old document's availability nor its counter is used to decide this result. The new A starts its own counter. - Switch back to
back. Set availability tono, then tounknown. Withno, there is no retained A to restore, so the count starts at 0. Withunknown, the model cannot tell which A you get. It gives no count, not a count of 0.
You can change the prior count to any whole number from 0 through 100. An invalid input gives an error rather than keeping the last result. With valid inputs, setting Required scenario evidence to missing stops the comparison before the navigation choice is evaluated. Reset returns to the original Back example with a retained document, evidence provided, and a count of 7.
What the counter tells you
The counter belongs to the document, not to its address. On restoration, A does not have to reconstruct the number 7: the counter that held 7 is the one you see again. On a new load, nothing has to erase the old count to explain the 0. You are looking at a different counter with its initial value.
That distinction holds even when the numbers match. Suppose you leave A with a count of 0. Restoring it gives you the old 0; reloading it gives you a newly initialized 0. The same visible value fits both explanations. Reusing data from the HTTP cache does not settle the question either: that cache holds response data, not the running document and its counter.
An in-memory counter can establish a distinction only under the fixture assumptions. In a real application, a new document might reconstruct the same value from saved state. Record the navigation and lifecycle evidence independently of the appearance of the restored interface.
In practice
To tell what happened on a real return to A, look at the persisted flag on A's pageshow event. A value of true indicates that the browser is showing the reused document. A value of false indicates a new load; it does not, by itself, mean that someone pressed Reload. The same flag on pagehide answers a different question. When you leave A, pagehide.persisted can be true because reuse is possible, even if the browser does not retain A until you come back.
The simulation takes availability as an input. It does not navigate a browser, check its eligibility rules, or observe a lifecycle event. If all you know about a real visit is that the visitor pressed Back, leave restoration undecided. Use pageshow on return to distinguish the two lifecycles. Then ask a separate question: if the document was restored, is the information it still displays current enough for the visitor's next action?
Frequently asked questions
Editorial questions based on the listed sources and explicitly labeled local examples.
Is bfcache the HTTP cache?
No. The back-forward cache can preserve a document and its execution state across navigation; the HTTP cache stores reusable response data. The two lifecycles differ.
Can restored state be stale?
Yes; app logic may need refresh.
Does every page qualify?
No. Eligibility and eviction depend on browser policy and document conditions. A history navigation alone does not establish that a prior document was restored.
What can distinguish restore?
Use applicable lifecycle evidence such as pageshow.persisted. A similar displayed counter might be recreated from saved application state without restoring the same document. The counter alone is not a bfcache diagnostic.
Sources & model boundaries
Primary references used for this explanation. The interactive example is an educational model, not a live check.
- Chrome/web.dev: back-forward cache
How bfcache works. Restored pages may retain stale UI state; pageshow persisted indicates restore, while pagehide persisted is only intent.
Checked .
- HTML Standard: Navigation and session history APIs
§7.2.7.6. For pageshow, persisted distinguishes reuse from a new load; a true pagehide.persisted indicates possible reuse, not a guarantee of later restoration.
Checked .