F11 Key Event Fire On Onload Using Javascript
Is there any way to fire F11 key event onload and automatic exit from that after some action.?
Solution 1:
Put your following code on your load event:
if ((document.fullScreenElement && document.fullScreenElement !== null) || (!document.mozFullScreen && !document.webkitIsFullScreen)) {
if (document.documentElement.requestFullScreen) {
document.documentElement.requestFullScreen();
} elseif (document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen();
} elseif (document.documentElement.webkitRequestFullScreen) {
document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
}
} else {
if (document.cancelFullScreen) {
document.cancelFullScreen();
} elseif (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} elseif (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
}
It will able to re-size of your window screen to device screen.
Post a Comment for "F11 Key Event Fire On Onload Using Javascript"