HTML5 Fullscreen API

HTML5 Fullscreen API

<h1>HTML5 Fullscreen API</h1>
<div style="padding:20px;">
    <button onclick="launchFullscreen(document.documentElement);" class="sexyButton">Launch Fullscreen</button>
    <button onclick="cancelFullscreen();" class="sexyButton">Hide Fullscreen</button>
</div>
Script
function launchFullscreen(element) {
  if(element.requestFullScreen) {
    element.requestFullScreen();
  } else if(element.mozRequestFullScreen) {
    element.mozRequestFullScreen();
  } else if(element.webkitRequestFullScreen) {
    element.webkitRequestFullScreen();
  }
}

function cancelFullscreen() {
  if(document.cancelFullScreen) {
    document.cancelFullScreen();
  } else if(document.mozCancelFullScreen) {
    document.mozCancelFullScreen();
  } else if(document.webkitCancelFullScreen) {
    document.webkitCancelFullScreen();
  }
}​

DEMO
HTML5 Fullscreen API HTML5 Fullscreen API Reviewed by Bhaumik Patel on 9:21 PM Rating: 5