How to make the browser (IE9) not respond to pressing Alt + Enter by the user? When you press these keys, the browser is done full screen.

  • Terribly interesting - why do you need it? - Zowie
  • I have an action fixed for Alt + Enter, and now I started doing support for IE and it turned out :) - angry
  • Honestly, I'm not sure that this is at all possible, especially considering that we are talking about so hotly loved by IE: D - Zowie
  • There must be some workaround ... - angry
  • instead of rewriting the code to suffer, IMHO is a complete duristics, again IMHO is wrong :) - Zowie

1 answer 1

Once asked this question. As a result, I had to abandon the use of Alt+Enter . Later, I found a single option that looks like the truth (the others were completely ridiculous and not working), like SO : programmatically generate event F11 (same as Alt+Enter ) with a delay of 100 ms. It turns out that the browser will first come the event to switch to full-screen mode, and then - to return to normal mode. But for the accuracy of this method can not vouch.

 <script type="text/javascript"> document.onkeydown = handleHotKeys; function handleHotKeys(e) { var keynum = getKeyCode(e); var e = e || window.event; if (keynum==13 && e.altKey) { // handle enter+alt setTimeout("toggleFullscreenMode",100); } } function getKeyCode(e){ if (!e) { // IE e=window.event; return e.keyCode; } else { // Netscape/Firefox/Opera return e.which; } } function toggleFullscreenMode() { var obj = new ActiveXObject("Wscript.shell"); obj.SendKeys("{F11}"); } </script>