Disable IE8 F12 Hotkey

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
// ...
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,817
Latest member
AdalbertoT

Latest Threads

Top