I have a page that is a bit long to load, so I added a spinner to load when the user click on a link to this page. On Chrome, when the user click on this page (and get the spinner displayed to show the page is loading), when the user is on the long processing page, then decide to get back, the spinner is there again.
The user has to manually reload the page to get rid of the spinner. On Firefox it's fine. I use to listen to popstate to execute a code to hide the spinner. But unfortunately this doesn't work anymore on new version of Chrome.
Here is what I used to have and it used to works for Chrome:
$(document).ready(function () {
if (window.history && window.history.pushState) {
$(window).on('popstate', function () {
loading.hide(); // this is the code to hide my spinner
});
}
});
To make it simple, I need a script that would be triggered only when user went back on a page.