Disable IE8 F12 Hotkey

  • Thread starter Thread starter Guido Kraus
  • Start date Start date
G

Guido Kraus

My ASP.NET web site uses some client side Javascript to capture keyboard
input, especially some function keys like F12. The new IE8 uses F12 to open
up some developer tool window. Is it possible to disable the F12 hotkey or
disable the default behavior?
My Javascript code looks something like this:

document.onkeydown = keyDownHandler;

function keyDownHandler(e) {
if (!e) var e = window.event;
var code;
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;
else return;
if (e.cancelBubble != null) e.cancelBubble = true;
if (e.returnValue != null) e.returnValue = false;
if (e.stopPropagation) e.stopPropagation();
if (e.preventDefault) e.preventDefault();
// do something useful according to keyCode
// ...
}
 
Back
Top