Friday, 3 August 2012

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