'How can I disable Alt-Enter in IE?

As the default behavior of IE is to switch to the full screen mode on Alt-Enter command. I've to avoid this and have to attach a custom behavior.

Is it doable?



Solution 1:[1]

Since you can't beat 'em, join 'em. Meaning, since you can catch the event but can't stop it, how about you just run the same command in a timeout after the user presses alt+enter?

Example:

<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>

DISCLAIMER: Tested in IE8. You will have to look at the browser and version to get this to work for the specific version of the browser you are targeting. This also assumes that the user will have javascript and activex objects enabled.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dan J