Showing results for 
Search instead for 
Did you mean: 
New Contributor

Lastpass browser plugins is preventing browser's back/forward cache from working

I wanted to report a bug but it seems the easiest way to do so is to engage with the community here.


With the latest chrome update (Version 111), I wanted to test the bfcache on a website I worked on. After a long session of debugging I found out that the problem was actually made by the lastpass chrome extension.


So what's going on is that lastpass plugin starts listening for the unload event on every page with prevents back-forward cache from working. See bfcache#never-use-unload-event 


If you're wondering why this is important? bfcache allows for instantaneous navigation within browser's history for the pages that have their caching mechanism configured correctly. The browser instantly loads the page from cache and restores the page's scroll where the user left it before navigating to another page.


For a demo of bfcache:


1. Go to Scroll down inside the page and then click on a link inside the page that loads another page on (eg. (note that some links might point to pages from different domains which might not have caching correctly configured)

2. In this page ( per my example) scroll down inside the page. Then click the browser's back button - you should see an instantaneous navigation to the previous page, with the scrolling restored to where you left it previously.

3. Click the browser's forward button - same behaviour. The page is loaded instantly and the scroll correctly restored.


Note that does some clever things under the hood on the scroll-restoration part and it works even with the LP plugin installed. However, on web-pages that use the default built-in caching & browser behaviour, the scroll restoration doesn't work the same.


To test if the bfcache works correctly, you can go on a page (eg., open DevTools, goto Application, then goto bfcache. There you should have a test bfcache button which does the test automatically.


If you do the test with the LP plugin installed and active, the test will fail. If you deactivate the LP plugin, the test will succeed. Hope this helps.