I am trying to use the pageshow event for safari (iphone) to fix some problems with back button cache. But it seems to work only once when using the back button.
I have this handler on page A :
window.addEventListener("pageshow", function () { alert("pageshow"); });
Then go to page B and go back to A - everything works fine. But when I go back to page B and go back to A again, then nothing will happen.
Example: go to this script: https://jsfiddle.net/y278q8q0/ , then go to any other page and play using the "Back" and "Forward" buttons. The event will fire only once.
The way it looks on iphone 6 with ios 8.4: https://vid.me/5WPe
change
Question
was marked as a duplicate of this: 'pagehow' was not received when clicking back on Safari * iPad "
It is difficult to say whether these problems have the same cause. In my case, the event always fires once at the beginning. I also tried to implement all non-jquery solutions from the question mentioned, and none of them work for me.
source share