You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Useful for mini carts not updating when back button is pressed (bfCache), mainly in Safari but also Firefox. Triggers a page reload.
Once your page is in a final state that you don't want to outlive a redirect, you can just bind the pageshow event and then check for the "persisted" property being true to determine if you should reload it.
I was having problems with the count on a mini-cart, so in addition to the above I had to keep the count element in the DOM, but instead use a class of "hide" to hide/show it depending on how many elements were in the cart.
Another solution to disable bfCache is to use the following:
```
window.addEventListener('unload', function () {});