title: Fullscreen using HTML5 and JavaScript
body: <p>I have tried to fullscreen a div using JavaScript. Here is my HTML and JS:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>    var elem = document.getElementById('fullscreenThis');
      function openFullscreen() {
      if (elem.requestFullscreen) {
          elem.requestFullscreen();
      } else if (elem.mozRequestFullScreen) {
          elem.mozRequestFullScreen();
      } else if (elem.webkitRequestFullscreen) {
          elem.webkitRequestFullscreen();
      } else if (elem.msRequestFullscreen) {
          elem.msRequestFullscreen();
      }
      }
      document.getElementById('fullscreen').addEventListener('click', openFullscreen);</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
      &lt;html lang="en"&gt;
      &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;body&gt;
      &lt;div id="fullscreenThis"&gt;
          Here is some code I want to fullscreen
      &lt;/div&gt;
      &lt;button id="fullscreen"&gt;fullscreen&lt;/button&gt;
      &lt;script src="main.js"&gt;&lt;/script&gt;
      &lt;/body&gt;
      &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>I have tried this in Firefox and Chrome.</p>