You open a website, scroll down, fill out a form, and navigate to another page.
Then you press Back.
The page appears almost instantly. Your form is still filled out. Your scroll position is exactly where you left it.
You might think the browser reloaded the page and restored some information.
But here's the interesting part: the browser may have preserved the entire page, including its JavaScript execution environment.
No HTML parsing. No component initialization. No JavaScript re-execution.
Welcome to the back/forward cache , or bfcache .
π΄ What Actually Happens When You Navigate Away?
Normally, when you navigate to a new document, the browser can discard the previous page.
Returning to it means constructing a new document, executing its scripts, and rebuilding its state.
Even with resources stored in the HTTP cache, there's still work to do.
But modern browsers have another option.
Instead of destroying the previous page, they can freeze it and preserve it in memory .
This includes:
Theβ¦