Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1345 In Internet Explorer 4 if I click the backspace key, and no element has focus, it behaves as if the history back button was clicked, how do I trap this event and disable it?

irt.org | Knowledge Base | JavaScript | Event | Q1345 [ previous next ]

Q1345 In Internet Explorer 4 if I click the backspace key, and no element has focus, it behaves as if the history back button was clicked, how do I trap this event and disable it?

Try:

<script language="JavaScript"><!--
document.onkeydown = mykeyhandler;

function mykeyhandler() {
    if (window.event && window.event.keyCode == 8) {
        // try to cancel the backspace
        window.event.cancelBubble = true;
        window.event.returnValue = false;
        return false;
    }
}
//--></script>

Feedback on 'Q1345 In Internet Explorer 4 if I click the backspace key, and no element has focus, it behaves as if the history back button was clicked, how do I trap this event and disable it?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 6th July 2009. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2009 irt.org, All Rights Reserved.