Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HK: Why hasn't bfcache been implemented more broadly across the internet?
3 points by hexage1814 on July 6, 2023 | hide | past | favorite | 2 comments
Often there is an obsession with something that you just can't let go, and to me, that's the fact that bfcache hasn't been more widely implemented to this day on internet. Essentially, bfcache allows a page to be stored in the browser cache, so when you browse back and forth, it instantly loads from the cache instead of reloading. This is a godsend if you frequently navigate between pages, such as going from site A to site B and then back to site A.

I remember back in the day when Opera still ran on Presto, and I absolutely loved this feature. However, Firefox has some settings that enable this functionality, but even now, it doesn't work on all pages. It's particularly annoying that it doesn't work on relatively simple pages like old.reddit.com.

Anyway, what is your take on this? It just seems like one of those amazing ideas that browser developers, for some weird reason, are too hesitant to implement. I wish there was a way to force bfcache on some pages. I understand that it might break the expected behavior on certain pages, so it should be implemented on a site-by-site basis or even on specific pages. It shouldn't be too complicated to make this work on simple pages with little to no JavaScript.

There have been discussions about this on bugzilla, and I believe similar talks have taken place in the Chromium project. Concerns about enabling a feature like this more broadly, essentially freezing all the states of page A while you navigate to page B, revolve around potential security risks. However, honestly, this whole thing seems pretty trivial. Putting a 1-minute time limit or so for the page to be removed from the cache could address those concerns in my opinion.



See https://web.dev/bfcache/

What's the problem? It looks like Chrome, Firefox and Safari support it according to that page. This associated feature seems to be supported in all major browsers:

https://caniuse.com/page-transition-events

As a web dev it doesn't seem I need to do anything special to enable it, but I must not use the unload event handler which is problematic anyway. Am I missing something?


> freezing all the states of page A

If page A requires running substantial javascript components, freezing the state could be pretty hard. What if going back to the page entails restarting the execution of some javascript to render page elements?

Don't dismiss potential security risks as "trivial" either. Maybe it's not a big deal to the person visiting the site, but it could expose the sites to costly hacks.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: