bfcache
The snapshot contains the entire page in memory, including the JavaScript heap; in-progess code is paused when the user navigates away and resumed when they return to the page. A regular HTTP cache entry on the other hand contains only responses to previous requests. The bfcache therefore provides faster results than the HTTP cache.
The downside is that bfcache entries require more resources, and create complexity in terms of how to represent in-progress code. Some code features (for example the
unload
handler) are not compatible, so their presence on a page blocks it from using the bfcache.
The bfcache is great for performance, so it is in your interests to make sure your pages are not blocked from using it. You can use the
notRestoredReasons
API
to monitor whether pages are blocked from using the bfcache, and reasons why.
See also
- Back and forward cache on web.dev (2023)