I am using the following code for disabling Ctrl-N in IE7. It disables the Ctrl-N feature of IE which opens a new window containing the same page as the 'active' window. The code works great (at first glance). However, I noticed that, if you click anywhere inside the browser window and THEN press Ctrl-N, the new window will open. If you don't click anywhere inside the window, the following code works. Can anyone see an improvement to the following code so that clicking inside the browser window doesn't bypass the javascript?
<BODY>
<Script>
document.onkeydown=checkKeys
function checkKeys()
{
if (event.ctrlKey && event.keyCode==78)
{
event.keyCode=0;
return false;
}
}
</script>
</BODY>
</HTML>