When a user logs out I'm trying to suppress the back button from rendering the previous page. The code seems to work but I notice on a iphone the previous page is displayed for a second or two before it's replaced with the logon screen. Is there a way to prevent that?
Here's the JS I'm using in the form
window.onpageshow = function(event) {
if (event.persisted) {
window.location.reload()
}
};
and then in the control file I simply use:
if(!isset($_SESSION['id']))
redirect("login.php");
I also tried the iframe solution but found that didn't work at all:
<iframe style="height:0px;width:0px;visibility:hidden" src="about:blank">
this frame prevents back forward cache <!--doesn't work -->
</iframe>