David David - 4 months ago 18
HTML Question

onclick go full screen

I'm creating a web-app for the upcoming Chrome Web-store... Is there a way to simulate F11 being pressed? Or simply a command that will make the current window go full screen (HTML / Javascript) ???

Answer

It's possible with JavaScript.

var elem = document.getElementById("myvideo");
if (elem.requestFullscreen) {
  elem.requestFullscreen();
} else if (elem.msRequestFullscreen) {
  elem.msRequestFullscreen();
} else if (elem.mozRequestFullScreen) {
  elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullscreen) {
  elem.webkitRequestFullscreen();
}
Comments