Browser Back Button

ThomasM

Member
Joined
Apr 5, 2006
Messages
17
Programming Experience
Beginner
Can anyone tell me how to disable the Browser's Back button.

I have Submit button on a Webform. Once the user clicks this I would like to disable the Browsers Back buton.

Any help would be greatly appricated !!!

Thomas
 
put in body tag

HTML:
Expand Collapse Copy
<script language="text/javascript">
   if (typeof window.event != 'undefined')
     document.onkeydown = function() {
     var test_var=event.srcElement.tagName.toUpperCase();
     if (test_var != 'INPUT' && test_var != 'TEXTAREA')
       return (event.keyCode != 8);
     }
     else
     document.onkeypress = function(e)
     {
     var test_var=e.target.nodeName.toUpperCase();
     if (test_var != 'INPUT' && test_var != 'TEXTAREA')
       return (e.keyCode != 8);
   }
</script>
With this script, it can disable backspace for backbutton but we can use backspace button on textfield/textarea
 
Last edited by a moderator:
Back
Top