I need to prevent the user to switch back to previous pages strictly. I show you example coding as follows:
<html>
<head>
<script type="text/javascript">
/* prevent back */
window.history.forward();
function prevent()
{
window.history.forward();
}
/* warning on unload */
window.onbeforeunload = function (e) { var message = 'Are you sure ?'; if (typeof e == 'undefined') { e = window.event; } if (e) { e.returnValue = message; } return message; }
</script>
</head>
<body onload="prevent();" onpageshow="if (event.persisted) prevent();" onunload="">
<!--content here-->
<a href="in.html">in</a>
</body>
</html>
The above page have link to another page, if i click back on that second page, it come back to this first page and showing warning and then move to second page;
Second page:
<a href="hello.html">hello</a>
I added warning script for some reason.
Now, what i need exactly is. When prevent back working, warning script should not work.
1.When user unload a page, should show warning script 2.when prevent back function unload the page, should not show warning script
Is there any way possible to disable going back from a page in all the way, any strict way? the above coding is not much strict. it will move forward on getting back.
Thanks.