Wednesday, 9 April 2014

Disable browser back button using javascript

Disable back button in Browser Using Javascript

Declare a script:

<script>
    function noBack() { window.history.forward(); }
</script>

Inside the body add the below lines like below

<body onload="noBack();" onpageshow="if(event.persisted)noBack();"onunload="">

Output for Firefox and IE are as follows,


No comments:

Post a Comment