0

I want an iframe to go fullscreen when i click a button. But i don't want to exit fullscreen on click. How to achieve this?

To enter fullscreen mode i use this code:

var elem = document.getElementById('gameiframe');
if (elem.requestFullscreen) {
  elem.requestFullscreen();
} else if (elem.msRequestFullscreen) {
  elem.msRequestFullscreen();
} else if (elem.mozRequestFullScreen) {
  elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullscreen) {
  elem.webkitRequestFullscreen();
}

Update: seems like only Firefox quits fullscreen on click. How to turn it off ?

lucifer63
  • 784
  • 9
  • 32
  • What browser are you using? In Chrome, the escape key will exit fullscreen mode, not a click. A working example is here (JSFiddle and similar sites don't handle fullscreen mode well) http://pastebin.com/hfnih5De. – Drew Gaynor Sep 16 '15 at 14:24
  • I use Firefox. And yeah, you're right, Chrome doesnt quit fullscreen on click. Maybe there is some config in Firefox to make it it dont quick ? – lucifer63 Sep 16 '15 at 21:49
  • I just ran the same example in Firefox 40.0.3, and it does not exit on click. – Drew Gaynor Sep 17 '15 at 12:04
  • Actually i'm talking about flash games that are embed in iframes, for example kongregate.com, go there, turn on some game, run it full screen and click. Will it exit fullscreen ? – lucifer63 Sep 17 '15 at 21:14

0 Answers0