Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

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?

You are here: irt.org | FAQ | JavaScript | Event | Q1345 [ previous next ]

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?'

©2018 Martin Webb