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?

function checkKeys()
if (event.ctrlKey && event.keyCode==78)
  return false;

8 Years
Discussion Span
Last Post by sbhavan

Well, my first question would be why disable CTRL+N? That still leaves CTRL+T (new tab in ie7) and it doesn't prevent them from just opening a new instance of IE7 the normal way. I personally despise when people alter my keyboard shortcuts and/or disable things on a site. If you're doing this it usually means you've designed something wrong previously and you're trying to make up for it.


I'm Running my Application in kiosk mode. If the user press CTRL+N it is opening in a new browser window which is in non-kiosk more. So I want to prevent it.

Thanking You.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.