none
How to disable backspace

    Question

  • Is there a way to disable backspace, so that when I am entering text in a form and hit the backspace, I don't accidentally go back a page if my cursor is outside of the text box?

    This is a major problem for online university tests that have essays, because you end up ending your test in the middle of an essay if you hit the backspace.

    Note - I don't want to disable this as a web-developer, but rather as a client. (IE, there's a lot out there on code to disable backspace on a web-page you wrote; I want to know how to disable it for all webpages of my copy of IE 6).
    Thanks.
    Jon
    Wednesday, February 21, 2007 10:06 PM

All replies

  • Hello Jon,

    As far as im aware to do what you are talking about would require the coding of the keyboard configuration to be changed, for example when in explorer (My computer ect.. not Internet Explorer) and you click on the backspace key it will take you to the previous page you where on, so if your in c:\ drive it will take you back to My Computer ect. now im not sure how exactly this can be done as im no coding genius, however there is one way to get around this.

    Depending on the keyboard you have, the multimedia ones come with software that allows you to change the key configurations, so the backspace key can be changed to not goto the previous screen, however this will change the way it operates in Windows to, so you will not be able to use it to go back in any Explorer windows as well as in Internet Explorer. The keyboard i have is Microsoft intelliTypePro wireless which comes with the software that allows you to modify the key settings.

    I dont know if this can be done on a normal keyboard or if you would need to be a multimedia keyboard, try searching for any software that changes the key functions. This is just a workaround to resolving the problem you have and isnt meant to fix the issue per say, try giving it ago and seeing if this resolves the issue, another idea would be to set another key the function of "goto previous page" so you dont loose that function. If you want anymore information just let me know on ozolayer@hotmail.com

    Omar Abul-Ragheb

     

     Edit: I managed to find some software that does it for you no matter what keyboard you have, goto http://www.softboy.net/ the fourth and fifth software listed downwards are free trials so you can test them to see if they produce the desired results...

    Better yet these two sites offer FREE software to change the keyboard functions for you, http://www.randyrants.com/sharpkeys/ and http://www.randyrants.com/sharpkeys/ which are mentioned on http://en.wikipedia.org/wiki/Computer_keyboard which also holds some more information regarding keyboard information and layouts.

    I havent tried any of the software so leave some feedback for others if one of them resolve the issue, and remember these programs will remap the key functions so they will change in windows too and not just IE6, so be carefull when modifying the keys!

    Hope this helps!

    Thursday, February 22, 2007 1:05 AM
  • Thanks for the suggestion, Omar.
     This almost works, but I want to be able to use the backspace key for its original function (backspace), instead of just disabling it, or assigning it to another key. It turns out that if you hold down shift and press backspace, it still does it's original function, but doesn't go back a page. However, with key-remappers, you can only remap to 1 key, and not a key combination.

    Jon
    Thursday, February 22, 2007 2:32 PM
  • Hi Jon,

    Sorry for the late reply, msdn doesnt have an e-mail alert for replies, if this is still a problem at the university, i have come across a possible solution, however it would mean requesting the users take the exams in firefox (i'm assuming as it's a university they have both browsers?).

    The solution i'm refering to can be found at http://www.mydigitallife.info/2008/06/22/disable-or-enable-backspace-as-go-back-page-browsing-function-in-firefox/

    Hope it helps.
    Sunday, June 22, 2008 5:57 AM
  • Use Notepad.  Cut and paste your answer.
    Monday, June 23, 2008 2:41 AM
  •  

    Yet ANOTHER example of Microsoft's 'brilliant' coders.  Anyone with ANY brains would allow this incredibly annoying, time-wasting and USELESS keyboard shortcut to be disabled, but not Microsoft. 

     

    I'm starting to use Firefox more and more every day.

    Sunday, July 13, 2008 4:55 AM
  • I couldn't agree more, I absolutely HATE that I'm constantly losing emails and entries on pages because of the backspace key!!!!  Unfortunately, it happens in Firefox too so I haven't found a solution yet!  If anyone else does, please let me know!

    Thanks!

    Monday, November 15, 2010 8:52 PM
  • Its the KK's.

    Test on this site....

    1. Create a travel log for the current tab by navigating to a number of different sites in the same tab.

    2. Return to this forum and click anywhere in the Client area to give focus to the body tag.

    3. Press the Backspace key.... history will go back 1.

    4. Go forward to return to this forum and then click on either of the Search text boxes (<input> tags) at the top of this page to give the input tags focus.

    5. Press the Backspace key... history does not go back....the backspace key behaves as expected when a control tag has focus.

    How to avoid the issue on your web sites -

    Ensure that each <input> tag has a sequential tabindex. The browser should place focus on the first <input> element in the tabindex sequence.

    or

    Create an initializing function that forces focus to the <input> tag of your choice.

    Those of you who validate your markup for section 508 compliance will already be aware of this requirement for keyboard navigation in web pages.


    Rob^_^
    • Proposed as answer by JustinRogers Friday, November 26, 2010 8:36 PM
    Tuesday, November 16, 2010 1:59 AM
  • Hi,

    This is a browser issue, not a web site development issue.

    I've lost several large forum posts in the MS forums and others by hitting the Backspace key while the writable HTML area on the web page clearly had the input focus - I could see the text cursor blinking.  So even this forum is not immune to the problem.  It doesn't matter at all whether tabindex is assigned in the HTML, or whether JavaScript is used to assign a default input field when the page is loaded.

    Yes, it's true that this forum had eventually implemented a safety net by including a prompt that prevents navigation if you've begun editing, which is certainly very helpful at combating this problem.

    But ultimately, the problem is that the cost of this feature, and the cost of every website having to write extra code to protect user data against this feature, does not outweigh its benefit.

    If the IE team is concerned that removing this capability to protect user data will cause those that depend upon it to consider using another browser, then simply add an option: "Backspace navigates back in history when an input field is not currently focused (and sometimes when it is focused)".  It should be disabled by default, though, because web pages don't currently function like rich client applications, thus they all cannot be expected to protect user data from inadvertent navigation related to common focus issues.  (Common, especially in this current AJAX pop-up age we live in.)

    If the IE team is keeping this legacy feature around as an accessibility tool for the physically disabled, then please consider including the aforementioned option anyway and simply enable it by default when any of the accessibility options in IE or in Windows are detected as enabled during the installation of IE.

    Thanks,
    Dave


    http://davesexton.com/blog
    Saturday, January 15, 2011 4:38 PM
  • no tabindex attribute here. no onfocus="this.select();"

    they are currently using jQuery 1.4.4 (the latest) , previously 1.2 something.


    Rob^_^
    Saturday, January 15, 2011 10:34 PM
  • Okay, this IS a big deal to people who write a lot on the web.
    I am Chief Editor at www.remarriagetoday.com and I can tell you it hurts the productivity of my staff.

    However, here are your solutions:

    Firefox – backspace only means backspace.
    Opera - backspace only means backspace.
    Chrome – add this extension: BackspaceMeansBackspace « Google Chrome Extensions
    In IE – you are stuck with this ‘feature’.

    My solution was to move to Chrome and then ADD the extension I referenced above. Problem solved, and productivity restored.


    Stephen Paul
    Chief Editor - www.RemarriageToday.com

    Tuesday, January 25, 2011 10:42 PM
  • window.addEventListener('keydown',function(e){if(e.keyIdentifier=='U+0008'||e.keyIdentifier=='Backspace'){if(e.target==document.body){e.preventDefault();}}},true);

    e.target==document.body

     

    ...mmm the field has not received focus or the event handler is bubbled.


    Rob^_^
    Wednesday, January 26, 2011 2:20 AM
  • Thanks for the suggestion, Omar.
     This almost works, but I want to be able to use the backspace key for its original function (backspace), instead of just disabling it, or assigning it to another key. It turns out that if you hold down shift and press backspace, it still does it's original function, but doesn't go back a page. However, with key-remappers, you can only remap to 1 key, and not a key combination.

    Jon


    Hi Jon,

    Keyboard + is a tool which allows you to associate all the touches of the keyboard with an action, including Windows key.
    The created shortcuts can be associated with a program or a particular text.

    So you'll be able to add the "shift + backspace" as a shortcut to "backspace" and assign it to IE only.

    http://en.kioskea.net/download/download-1788-clavier

    Yan

    Friday, January 28, 2011 2:12 PM
  • Hi,

    AGAIN, I just lost an entire post (this time in the CodePlex forum) before it was submitted because IE9 interpreted me pressing the BACKSPACE key incorrectly.  It may sound crazy, but with a textbox in focus and a LARGE post being written, I actually just wanted to delete a single character and not navigate away from the page.  I had just spent at least 20 minutes thinking deeply about a subject and writing my thoughts.  They are all gone now.

    I'm totally angry right now - holding back ten paragraphs of rants.  This "feature" simply must go.

    I'm considering appending a new post here each time that this happens to me.  For me, this is the 5th time, at least.

    - Dave


    http://davesexton.com/blog
    Monday, May 16, 2011 12:10 PM
  • Hi jon, you can use this code, it will allow backspace only in text field and text area-

    document.onkeydown = function () {
     var e = event || window.event;
     var keyASCII = parseInt(e.keyCode, 10);
     var src = e.srcElement;
     var tag = src.tagName.toUpperCase();
     if(keyASCII == 13) {
      return false;
     }
     if(keyASCII == 8) {
      if(src.readOnly || src.disabled || (tag != "INPUT" && tag != "TEXTAREA")) {
       return false;
      }
      if(src.type) {
       var type = ("" + src.type).toUpperCase();
       return type != "CHECKBOX" && type != "RADIO" && type != "BUTTON";
      }
     }
     return true;
    }

    Tuesday, June 07, 2011 8:52 AM
  • I'm very annoyed by this problem as well.  The best solution I've found is to use Autohotkey, and run this code that I made:

     

    #IfWinActive ahk_class IEFrame
    BS::
    Send +{BS}
    return
    #IfWinActive

     

    It requires having autohotkey running, but when it detects that an IE window has focus, and presses Shift+Backspace instead of backspace.  This behaves just like backspace, but it doesn't make the browser trigger the "Back" command.

    I know it's less than ideal, but it's the best solution I've encountered

    Friday, August 05, 2011 10:58 PM
  • I can't wait for the day, when Retardosoft files for chapter11 due to mornons working for them. WHAT IDIOTS!
    Wednesday, February 08, 2012 6:40 PM
  • Hi,

    Again, I just lost another post in the MSDN forum due to the crazy backspace key navigating away from the page after painstakingly researching and writing an accurate and informative response to somebody's question.  It's all gone now.  Thankfully, this post wasn't as long as others that I've lost in the past due to this same issue.

    This time I'm using IE 10 on Windows 8.  I've got no content-related add-ins enabled.  Seriously, this is beyond ridiculous now.

    Details:

    1. I clicked Reply to somebody's question.
    2. I typed in my answer with a placeholder for a code snippet.
    3. Finally, I attempted to add the code snippet by placing the text cursor in the correct place and then clicking the insert code button on the forum editor's toolbar.  All is normal so far.
    4. When the popup opened, I selected C# as the language and pasted the snippet from my clipboard.  I noticed that there was a trailing whitespace at the end due to the blinking cursor, so I pressed backspace to delete it.
    5. IE 10 decided that I wanted to navigate backward in history.  So it did.  No prompt, no warning, just navigated.

    Wonderful.  I'm sure the backspace key for navigating backward in history is a really useful feature.  :P  Let's make the spacebar navigate forward and the L key shutdown Windows.  Sounds good.

    - Dave


    http://davesexton.com/blog

    Sunday, December 23, 2012 5:28 PM
  • No prompt, no warning, just navigated.

    On Answers this would not happen because then you would get a warning about navigating away from your typing.   So, you might want to make this suggestion for enhancing these forums.   Or reinforce any related suggestion which is already there.   ;  }

     

    There are other surprising cases where you can lose your work without completely understanding what the consequences of your actions might be.   An example is: clicking Vote as Helpful.   That's why it is always a good idea to backup anything that you have invested a significant amount of time and effort in.   E.g. at least do an occasional Ctrl-a, Ctrl-c  to have a copy in ClipBoard.   Or, even better, paste it into a Wordpad or window and press Ctrl-s.   Then, you will have also guarded against an unexpected power failure or system crash.   BTDT.   ;  )

     

    ---


    Monday, December 24, 2012 8:06 PM
  • Since Microsoft can't seem to unfornicate this completely stupid behavior, I have to--once again--dump IE and use something else.  Seriously, this is an asinine problem that has existed far too long.
    Sunday, December 30, 2012 3:29 PM
  • Hi,

    see quirksmode.org to see how to cancel bubbled events in both MSIE browsers, webkit and mozilla. In MSIE browsers if the event bubble is not cancelled the backspace key is bubble to the body object...

    or

    ensure that you place focus on the first <input> element when you page loads...either by specifying the tabindex attribute or using onload="document.getElementById('txtFirst').focus();"

    Its your code stu....

    When asking questions in this public peer to peer forum about html, css and scripting for website developers it is helpful if you can provide a link to your website for us (volunteers) to have a look at... otherwise and answer offered would be a guess... please post to the rantsforum.com otherwise...

    thx.


    Rob^_^

    Thursday, January 03, 2013 12:27 AM
  • This is ridiculous enough to make me want to return my Surface Pro 2.  While the keyboard is amazing for a tablet, it isn't exactly 100% accurate.  I'm losing too much work to backspace issues.  Microsoft, this is worth fixing.
    Monday, November 11, 2013 3:21 PM
  • This causes so many users problems where I work. For some reason the page loses focus, and you hit backspace, and BAM, all your work is gone. In rich apps this is particularly anoying.

    Microsoft please allow us to disable the backspace key in IE from acting as a hotkey.

    Thursday, March 20, 2014 8:52 PM