问题
Which browsers nowadays support a back-forwards cache (bfcache)?
A back-forwards cache is a browser's in-memory cache that is used when a user clicks the back button and the forward button. It stores the state of the page as it was when the user navigated away, so any changes made to the DOM should be loaded instantly.
Note that this is different from the normal caching mechanisms that all browsers have. A bfcache applies specifically when a user clicks the back button, and can handle dynamic changes in the DOM.
The only information I can find about this bfcache is years old, referencing Firefox 1.5. Do modern browsers support it? Where can I find information about it?
回答1:
Firefox: yes
Firefox supports a back-forwards cache, you can find details here:
- Using Firefox 1.5 (back-forwards) caching
- Working with BFCache (in Firefox)
Note that the bfcache does work in newer Firefox versions like version 75, despite how old the documentation is. Note that it is easy for pages and for extensions to deactivate the bfcache by accident. I found that I had an extension installed that deactivated the bfcache on all pages.
Safari: yes, but not HTTPS?
With regards to Safari, all I kind find is this article:
- WebKit Page Cache I – The Basics (2009) from webkit.org
This article states that the Page Cache (its name for the back-forwards cache) is disabled on all pages that use HTTPS, which in today's web, is a large portion of them.
Chrome: not yet
Chrome does not support a back-forwards cache. However, their developer team announced that they are exploring adding this feature to Chrome:
- Exploring a back/forward cache for Chrome (2019)
See chromestatus for this feature.
来源:https://stackoverflow.com/questions/60382446/which-browsers-have-a-back-forward-cache-a-bfcache-keeps-modifications-to-dom