Skip to content

Instantly share code, notes, and snippets.

@benjaminfisher
Created November 7, 2012 00:03
Show Gist options
  • Save benjaminfisher/4028562 to your computer and use it in GitHub Desktop.
Save benjaminfisher/4028562 to your computer and use it in GitHub Desktop.
Cross browser full screen API access
// Find the right method, call on correct element
function launchFullScreen(element) {
if(element.requestFullScreen) {
element.requestFullScreen();
} else if(element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if(element.webkitRequestFullScreen) {
element.webkitRequestFullScreen();
}
}
// Launch fullscreen for browsers that support it!
launchFullScreen(document.documentElement); // the whole page
launchFullScreen(document.getElementById("videoElement")); // any individual element
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment