Home » Microsoft Technologies

How to disable backspace

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).

11 Answers Found


Answer 1

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!

Answer 2

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.


Answer 3

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.

Answer 4

Use Notepad.  Cut and paste your answer.

Answer 5

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.


Answer 6

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!



Answer 7

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.


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.


Answer 8


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.



Answer 9

no tabindex attribute here. no onfocus="this.select();"

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


Answer 10

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


Answer 11




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


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).

I am doing an addin(outlook) project.. I am using formregion as adjoint.. My form region contains a textbox... My problem is "I couldn't use backspace or delete key in the textbox... While pressing the backspace in the textbox nothing will happen.. while pressing delete button on the textbox then the selected mail will delete... How can handle this two button from the system default?
Good Afternoon,

I was wondering if any of the current controls have a functionality where we can delete a complete word via single backspace?

for example: the words "hello world" is in a text box. 

If we do a backspace when the cursor is after 'd',
It would result in: "hello worl"
I would like the result to be: "hello"

the word 'world' is deleted, instead of just the 'd' of 'world'.

if not, any ideas on how I can accomplish this?



I am using combobox from AjaxControlToolKit. If I enter some info in the text portion of my combobox, then click out of it and return to it to change what I typed, using the backspace key, I get a JScript runtime error (null or not an object). This also hapeens if I try to fix the text using the delete key under the same conditions.

Does anyone have an idea of what could be going on here. I am using the most updated version of the AjaxControlToolkit, which is v.3.5, which was released in April or May this year.

Any advice would be really appreciated.





I am working on an app and have added masked edits to some of the textboxes. On Google Chrome v6.0.472.62 the backspace button is inoperative along with the delete button. I have found no method around this. It also functions incorrectly on the ajax toolkit website: http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/MaskedEdit/MaskedEdit.aspx

Does anyone have a workaround or fix? Chrome is fairly popular and I doubt I can use this code with this issue.


I have the following snippet to control a TextBox that will allow only numbers, a decimal point and a / character, what I don't understand is why when I click on backspace the label gets populated with "Must be fraction..."

Is there a better way to write this?

PrivateSub TextBox1_KeyPress(ByVal sender AsObject, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress

    Dim intChars AsString = "0123456789/. "
    ' If the values are not a number, tell usIf intChars.IndexOf(e.KeyChar) = -1 Then
      e.Handled = True
      Label1.Text = "Must be a fraction or decimal value only"' Otherwise, clear the label and continueElseIf e.Handled = FalseThen
      Label1.Text = ""EndIfIf e.KeyChar = Chr(8) Then' Allow backspace
      e.Handled = FalseEndIfIf Asc(e.KeyChar) = 13 Then
      Label1.Text = TextBox1.Text ' Accept Return and post valueEndIfEndSub


Hi guys!

I've got an AutoCompleteExtender on one of my pages, it seems to be working fine aside from this strange behaviour:

Let's say I key in 2 characters, the suggestion list would display. When I press on backspace to delete those 2 characters, wait until the suggestion list to disappear, and re-enter those 2 characters, the suggestion list would no longer display (or sometimes would flicker for about a second after losing focus from the textbox) and I'll need to refresh the page just to get it working again.

However, if I do press backspace and delete those 2 characters but not let the suggestion list to disappear and re-enter new characters, it would continue displaying with correct suggestions. This behaviour seems to happen only in IE8, (although it works with IE8 using Compatibility View and Firefox)...

My code is almost the same as the sample on this site except for the animations, and the service looks up in a database table.

<asp:AutoCompleteExtender runat="server" ID="autoComplete1" TargetControlID="searchTextBox"
                        ServicePath="~/common/AutoComplete.asmx" ServiceMethod="GetJobNumberList" MinimumPrefixLength="2"
                        CompletionInterval="1000" EnableCaching="true" CompletionSetCount="20" CompletionListCssClass="autocomplete_completionListElement"
                        CompletionListItemCssClass="autocomplete_listItem" CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" DelimiterCharacters=";, :" >

Thanks in advance!

Hello All.

I Have a WPF Textbox on a window.

It receives keydown events, but it is not possible to change the text in the textbox.

 The Space, Backspace and delete keys work to change text that is already there, but none of the letters work( even though, as I said, the keydown events are registering ok)

I suspect, although I don't know why, that the events are being intercepted somewhere along the line, but I am not sure how I would go about finding out where exactly.

Can anybody give me a nudge in the right direction?


 I've added a KeyDown event to a textbox but it's not raised when the 'backspace' or 'delete' key is pressed. How can I raise events for those keys?

 Thanks for help!




i have an issue with backsapce in vsto application.

i have a keypress event in which  if user presses backspace then i am calling the selection.Typebackpace() which is causing the problem explained below.

suppose i have word "were" and i put the cursor at the alphabet "r" and call the selection.Typebackpace() in my add-in i see that both characters  "er" are getting deleted if i see the document .I suspect that  one backspace we are calling from application and other word calls itself is there any way i could stop the default behavior of word backspace .

i need this scenario because  in the keypress event when user types backspace i am taking the word from selection.range.text and comparing it with the data store to check for equality and applying formatting, but in key press event  for word "were"   the word is still "were" instead of "wee" .



Any help is apprecaited.





Hello All,

I'm assigning readonly property to textbox in my page. I'm getting couple of issue. Even though the textbox is readonly, I can click on it (cursor blinks in the textbox) and then of I press backspace, it takes me to the previous page. I'm not suppose to used enable property. Please advise.




In my winform application I have webbrowser control. I need to handle backspace keypress to navigat? to another page when this button was pressed. I found PreviewKeyDown event of the webbrowser control.

I used this event but now I need check if backspace button was pressed inside of the textbox or some textarea. User need type in that controls. Now when he try delete some wrong character my application is catching previewkeydown event and navigate user to other page.

How I could check if user press backspace when he was in textbox?


Hi Guys,

I'm trying to create a BMI Calculator with VB 2010.

I have 2 TextBoxes for weight and length. I want to make sure that the user can only enter numeric (0123456789) values and also backspace and delete.

Can anyone help me ?

Thanks in advance...


Hi everybody,

   How to disable the right click of mouse? Please provide codes. How to disable
the Print Screen Key so that user cannot use it? Please provide codes. Applicable
to both windows and web applicatuions. Thanks.



Hi everyone,

I don't know if you face the same problem when your page logic has to set the enabled textbox's property to FALSE.  If i use FireFox to browse the page, my disbled controls are show with a dark-silver background color (perfect for me), but when i browse with IE, disabled or enabled textboxes are show the same way (no color differences).

Is there a way to manage controls appearance depending on the Enabled property?

I appreciate your support.


the issue may seem stupid enough, but not mystical.
The behavior started to show self after I set "Visual Source Safe" as "Source Control" tool. As you check out the item you're not able to use any of the above typed keys, but others and mouse. You can achieve NORMAL_EXPECTED_BEHAVIOR of the keyboard as you close and start the Visual Studio again. And here is the mistical point that should explain. Where is that magical option box that I should set false/true that to get back the NORMAL_EXPECTED_BEHAVIOR of the keyboard and environment?
And which edition is that in the future that the environment will not assume developer as a stupid piece of meat around the table? Making assumptions beforehand instead of the people who will be using the tool, without considering changes in the expected behaviors of the development environment in out of expected direction is not healty idea and decision at all.

Dear colleagues!

I have some strange trouble with keyboard in isolated shell.

I developing my own language service based on MPF. I created a package for Visual Studio 2008 using Visual Studio 2008 SDK accordingly. I got PLK and SLK from MS VSIP web site.
While I was developing and debugging it in Experimental hive everything was OK. Then I added a Visual Studio Isolated Shell Project (not after the first try) and attach a package to it (added PLK and SLK, made .pkgdef file, call VsStub.exe with /Setup key). After that I've got working standalone application, package is loading properly, syntax is highlited, no errors was shown. But: backspace, insert, page down, page up, home, end and Ctrl+J do not work. They just do nothing. When I hit them nothing happen. On the other hand, Ctrl+X, Ctrl+Home, Ctrl+End work. And Ctrl+Space result in typed space (char) in the editor instead of cause the autocompletion.

So, I couldn't even suppose what is wrong. May be I should register language service properly, may be core editor in isolated shell do not support these keys (very strange case), may be there is just a bug in result of troubles creating Visual Studio Isolated Shell project.

If you need more information about the environment, my steps for creating standalone application or something else just let me know.

Best wishes,
  Vladimir Serykh.


I don't want the cursor to move to the end of the previous line when I press backspace at the beginning of a line.  How do I stop this behavior?

This is happening in the code editor in Visual Studio 2010.  I'm sure there is an option somewhere to stop this behavior, I just can't find it.  And I've searched, and searched but to no avail.

An answer would be appreciated as this behavior is most annoying and time wasting.  Thank you!



 Hi there,

If a control is disabled (enabled = false), will the validator controls associated with it automatically know not to carry out validation?

i have a checkbox and a textbox, if the checkbox is checked, the textbox is enabled, and has to have a value, where i used a required field validator.

but if the checkbox is not checked, textbox is then disabled, however, the validator controls still seem to be trying to validate the disabled textbox.

so is there a way to disable validator according to textbox's state? such as textbox.enable = true? seems like causevalidation method requires multiple button, however i only need one...


thanks in advance!


Hi, i'm new at this, how would you stop someone using the alt key, like alt+F4, alt+ctrl+delete OR alt+tab


<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure