This issue -was- solved in older versions of Safari (The Safari Back Button Problem). Although running the latest Safari (9.0.1), none of the solutions listed on the previous answer work anymore. Does anyone have a solution to "refresh/reload" the page when the back button on safari is used?
This -was- a way to detect if the page was accessed using the back-button. Although doesn't work in the version of Safari I'm using.
<body onunload="">
Most links that you click on tend to open in the same browser tab. But if the Back button on a page that you just loaded appears grayed out, that's likely because it opened up in a new tab or window. In that case, you can't use the Back button. The only way to go back to the previous page is to switch tabs or windows.
Safari browser has its memory management system, which kills the inactive webpage whenever it needs more RAM. Next time when you revisit the old inactive tab, it automatically starts reloading the page. It is an excellent feature of RAM management.
How do I get it back? Answer: A: Answer: A: Choose Show Toolbar or Customize Toolbar from the View menu and put it back.
You have to detect browser back button event and pass as an input of the page you want do prevent URL reload that indicates you if you came from a back button click. this code: $(window). on('popstate', function(event) { alert("pop"); });
Other answers bind things to window.onpageshow, but this is the only version that works for me: 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.
window.addEventListener("pageshow", function(evt){
if(evt.persisted){
setTimeout(function(){
window.location.reload();
},10);
}
}, false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With