File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes How to disable Backspace button in IE using JavaScript? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "How to disable Backspace button in IE using JavaScript?" Watch "How to disable Backspace button in IE using JavaScript?" New topic
Author

How to disable Backspace button in IE using JavaScript?

harivarma mudunuru
Greenhorn

Joined: Sep 07, 2000
Posts: 8
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
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:

<A HREF="javascript:location.replace('nextpage.html')">Advance</A>


I never took notes in college. That's how I got a 4.0 the first 2 years, and a 3.5 the second two years.
Richard Ball
Greenhorn

Joined: Nov 13, 2002
Posts: 6
The following seems to work well for disabling the Backspace and Alt Left and Right Arrows:
Richard Ball
Greenhorn

Joined: Nov 13, 2002
Posts: 6
Sorry. A slight modification is needed to disallow Alt arrows while inside form control.
 
 
subject: How to disable Backspace button in IE using JavaScript?
 
Threads others viewed
disable alt + left arrow
How to disable back button of Safari
Retrict copy from a text field
Disable BACKSPACE for backbutton functionality but keeping the BACKSPACE to edit text
back button in mozilla
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture