How to prevent page going back on backspace button click

Stop page going back on backspace button click in asp.net,C#,java,PHP.


1. To prevent page going back on backspace or browser back button. you can achieve this by short snippet by javascript below.

<script type="text/javascript">
function preventBack()
{
window.history.forward();
}
setTimeout(function () { preventBack() }, 0);
window.onunload = function () { null };
</script>
.

Follow my blog with Bloglovin

Comments