2

Is there any way to fire F11 key event onload and automatic exit from that after some action.?

Supun Wijerathne
  • 11,964
  • 10
  • 61
  • 87
JBNavadiya
  • 109
  • 1
  • 3
  • 11
  • 2
    Can you provide a specific example of what you want to do? This isn't clear enough, and is liable to be closed as "unclear what you're asking". – joews Jun 10 '14 at 06:23
  • 1
    Answers on this question may help: http://stackoverflow.com/questions/424407/handling-key-press-events-f1-f12-using-javascript-and-jquery-cross-browser – joews Jun 10 '14 at 06:24
  • http://stackoverflow.com/questions/2863351/checking-if-browser-is-in-fullscreen – Pramod S. Nikam Jun 10 '14 at 06:25
  • I want to make one demo using sets of images so when user come on webpage than fullscreen will be automatically come and demo should be start.After demo over automatically exit full screen mode. – JBNavadiya Jun 10 '14 at 06:27
  • Here you can find some help : http://stackoverflow.com/questions/19856794/automatic-browser-full-screen-switch-on-document-load-ready – Md Ashaduzzaman Jun 10 '14 at 06:32

1 Answers1

2

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();
            } else if (document.documentElement.mozRequestFullScreen) {
                document.documentElement.mozRequestFullScreen();
            } else if (document.documentElement.webkitRequestFullScreen) {
                document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
            }
        } else {
            if (document.cancelFullScreen) {
                document.cancelFullScreen();
            } else if (document.mozCancelFullScreen) {
                document.mozCancelFullScreen();
            } else if (document.webkitCancelFullScreen) {
                document.webkitCancelFullScreen();
            }
        }

It will able to re-size of your window screen to device screen.

Bazzinga...
  • 996
  • 2
  • 16
  • 26