How to disable Backspace button in IE using JavaScript?
harivarma mudunuru
Greenhorn
Joined: Sep 07, 2000
Posts: 8
posted
0
I want to disable backspace button(i.e visiting previous page), Alt+left, and Alt+Right. I have used the follwed code. But it's giving problems some times. function noBack() { if((event.keycode==8) | |(event.keycode==37 && event.alt_key) | | (event.keycode==39 && event.alt_key) ) { alert(function disabled); history.go(0); } } and in body <body onkeydown="noBack()"> can any one help me?
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 3901
posted
0
this might do what you want. The location object's replace() method overwrites the current history entry with the specified URL. It removes the current history entry before the next URL is loaded. Removing the item from the history list also prevents users from seeing the page again by clicking on the Back button later. This technique is very useful for online games and multi-page forms, where you want prevent the user from returning to the previous page. Furthermore, the location.replace() method is supported by all browsers except Navigator 2.0x. The following example shows how to use this method in a link: