473,789 Members | 2,732 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Capturing and Suppressing the Backspace Key In IE

Hi,

Is it at all possible to capture and suppress the backspace key when
focus is not on a form edit control? Basically, while the page is
loading I don't want the user pressing the backspace key which IE
interprets as a desire to return to the previous page.

Thanks
Jul 23 '05 #1
6 15604


Robert Nurse wrote:
Is it at all possible to capture and suppress the backspace key when
focus is not on a form edit control? Basically, while the page is
loading I don't want the user pressing the backspace key which IE
interprets as a desire to return to the previous page.


<html lang="en">
<head>
<title>capturin g and cancelling the backspace key</title>
<script type="text/javascript">
document.onkeyd own = document.onkeyp ress = function (evt) {
if (typeof evt == 'undefined') {
evt = window.event;
}
if (evt) {
var keyCode = evt.keyCode ? evt.keyCode : evt.charCode;
if (keyCode == 8) {
if (evt.preventDef ault) {
evt.preventDefa ult();
}
return false;
}
else {
return true;
}
}
else {
return true;
}
}
</script>
</head>
<body>
<p>Is the backspace key cancelled?</p>
</body>
</html>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
Robert Nurse wrote:
Hi,

Is it at all possible to capture and suppress the backspace key when
focus is not on a form edit control? Basically, while the page is
loading I don't want the user pressing the backspace key which IE
interprets as a desire to return to the previous page.

Thanks


Perhaps, but why do you want to do this? If you find IE annoying then use a
different browser. Disabling navigation features like this is not going to
improve the accessibility of your website.

--
Philip Ronan
ph***********@v irgin.net
(Please remove the "z"s if replying by email)
Jul 23 '05 #3
Robert Nurse wrote:

Is it at all possible to capture and suppress the
backspace key when focus is not on a form edit control?


Rule #1: DO NOT INTERFERE WITH THE OPERATION OF THE USER'S WEB BROWSER.

Do not suppress or override key presses. Do not suppress or override
mouse clicks. Do not hide the menu. Do not overwrite the status text.

Just because something is possible does not mean that it should be done.
The above should almost never, if ever, be done.

This is not a flame. It is a warning.

bblackmoor
2004-11-03
Jul 23 '05 #4
JRS: In article <BD************ **************@ virgin.net>, dated Wed, 3
Nov 2004 16:34:39, seen in news:comp.lang. javascript, Philip Ronan
<ph***********@ virgin.net> posted :
Robert Nurse wrote:

Is it at all possible to capture and suppress the backspace key when
focus is not on a form edit control? Basically, while the page is
loading I don't want the user pressing the backspace key which IE
interprets as a desire to return to the previous page.
Perhaps, but why do you want to do this? If you find IE annoying then use a
different browser. Disabling navigation features like this is not going to
improve the accessibility of your website.


On the Internet, an author does not get to choose the user's browser -
unless he is prepared to write pages of restricted compatibility. An
author should want, as far is possible, to prevent unfortunate effects
from user actions. The real question is whether the gains from making
such a change to the user interface would outweigh the losses.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #5
It is when it's a closed system and you have Fed users who want things
a certain way no matter what you tell them. It'd be too long and
laborious to explain my situation. All I can say is, I work for a
tough crowd :). They (even I) wasn't aware of this "feature" before
we ran into it by accident.

Brandon Blackmoor <bb********@bla ckgate.net> wrote in message news:<2u******* ******@uni-berlin.de>...
Robert Nurse wrote:

Is it at all possible to capture and suppress the
> backspace key when focus is not on a form edit control?


Rule #1: DO NOT INTERFERE WITH THE OPERATION OF THE USER'S WEB BROWSER.

Do not suppress or override key presses. Do not suppress or override
mouse clicks. Do not hide the menu. Do not overwrite the status text.

Just because something is possible does not mean that it should be done.
The above should almost never, if ever, be done.

This is not a flame. It is a warning.

bblackmoor
2004-11-03

Jul 23 '05 #6
Robert Nurse wrote:
It is when it's a closed system and you have Fed users
who want things a certain way no matter what you tell
them.


Tell them that interfering with the user's web browser in that fashion
violates the requirements of Section 508, with which all US Federal
agencies are required to comply, and that you have no choice in the matter.

Being an expert in your field is the best defense against being asked to
do something stupid.

bblackmoor
2004-11-03
Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2332
by: Dennis Craven | last post by:
Hello, Does anyone know how one could insert a backspace into a widget such as a TextView/Buffer in Pygtk? Whenever I try something like insert(iter, '\b') I get jibberish inserted into the buffer. Thanks, ~djc
1
1740
by: haxmya | last post by:
Ok, made an explorer toolbar (band Object) with a textbox on it. Everything works great....except that the backspace button doesn't actually backspace when you're in the textbox. Shift-backspace works but regular backspace doesn't. Does anyone have any ideas? Posted Via Usenet.com Premium Usenet Newsgroup Services ----------------------------------------------------------
3
10566
by: coolsti | last post by:
Can someone help me enhance this code snippet which works only for IE so that it will also work for Firefox? I have been trying all sorts of things and have gotten to where I can capture the keydown and keypress events in Firefox, but then I can't seem to get the key code. I also don't know if the window.event.srcElement.type works with Firefox or if the onkeydown="return false" is valid in Firefox. I have this Javascript at the end of...
40
7903
by: Dave Hansen | last post by:
Please note crosspost. Often when writing code requiring function pointers, it is necessary to write functions that ignore their formal parameters. For example, a state machine function might take a status input, but a certain error-handling state might ignore it: typedef void (*State_Fn)(uint8_t); void error_state(uint8_t status)
1
6262
by: Blue | last post by:
This JS limits the input characters into the form. How do I modify it so that it also allows CARRIAGE RETURN and BACKSPACE (for making text correction)? Due to the template engine I am using, I cannot use IF/ELSE statement. ============================== <form> <textarea name="event_description" ONKEYPRESS="if (document.layers)
2
4770
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
I have a tabcontrol where I want to capture the CTRL+C key combination. My tabcontrol has on its tabpages some treeView controls. My intention is to intercept the event of pressing the CTRL+C when one of the controls embedded in the tabControl has the focus. I'm doing this using the KeyDown event. However, when pressing the CTRL+C my computer sounds a beep - as in 'not allowed' beep. The capturing of the keycombination works fine, however,...
3
6400
by: Bobby | last post by:
Hi I'm using Access 2003 with SQL server 2000, linked via ODBC. Can anybody tell me how to capture SQL error codes in Access? If this is not possible, is there any way I can simply turn off SQL errors? Can I use docmd.setwarnings false? If so which event would I put it on. On error doesn't seem to work. Thanks
5
2478
by: Don Li | last post by:
Hi, A web app server package that I'm using includes a bunch of open source UI components (heavy with javascripts). Inevitably it has bugs, e.g. "undefined" is null or not an object. This naturally erodes confidence for novice web users for the app in question. The techniques that I found and tried after research for suppressing
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10410
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9984
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5418
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3701
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.