title: How to open Web page in Fullscreen mode (F11 functionality) on body load
body: <p>I am building a web application and I’m want to our web application open on fullscreen in browser by default
  I want, as our application run on browser at the same time it will open in full screen mode.
  I’m getting output on button click but this is not working on onload event of body.</p>
  
  <p>Javascript Code:</p>
  
  <pre><code>&lt;script&gt;
      function show() {
          var elem = document.body;
          if ((document.fullScreenElement !== undefined &amp;&amp; document.fullScreenElement === null) || (document.msFullscreenElement !== undefined &amp;&amp; document.msFullscreenElement === null) || (document.mozFullScreen !== undefined &amp;&amp; !document.mozFullScreen) || (document.webkitIsFullScreen !== undefined &amp;&amp; !document.webkitIsFullScreen)) {
              if (elem.requestFullScreen) {
                  elem.requestFullScreen();
              } else if (elem.mozRequestFullScreen) {
                  elem.mozRequestFullScreen();
              } else if (elem.webkitRequestFullScreen) {
                  elem.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
              } else if (elem.msRequestFullscreen) {
                  elem.msRequestFullscreen();
              }
          } else {
              if (document.cancelFullScreen) {
                  document.cancelFullScreen();
              } else if (document.mozCancelFullScreen) {
                  document.mozCancelFullScreen();
              } else if (document.webkitCancelFullScreen) {
                  document.webkitCancelFullScreen();
              } else if (document.msExitFullscreen) {
                  document.msExitFullscreen();
              }
          }
  
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>HTML Code:
  This is working</p>
  
  <pre><code>&lt;input type="button" value="click to toggle fullscreen" onclick="show()"&gt;
  </code></pre>
  
  <p>But this is not working</p>
  
  <pre><code>&lt;body onload="show()"&gt;
  </code></pre>
  
  <p></p>
  
  <p>Please help me how can I achieve this.
  Thanks.</p>