title: detect whether the screen is in a full screen
body: <p>I made a button to allow the screen to go to full screen and vice versa. However, there is also shortcut for user to go to full screen using the computer/laptop button F11.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;
  Zoom
  &lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;script type="text/javascript"&gt;
  //fullscreen();
  function fullscreen() {
      var change = document.getElementById("fullscreen");
      if ((document.fullScreenElement &amp;&amp; document.fullScreenElement !== null) ||
          (!document.mozFullScreen &amp;&amp; !document.webkitIsFullScreen)) {
          if (document.documentElement.requestFullScreen) {
              document.documentElement.requestFullScreen();
          } else if (document.documentElement.mozRequestFullScreen) {
              document.documentElement.mozRequestFullScreen();
          } else if (document.documentElement.webkitRequestFullScreen) {
              document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
          }
          change.innerHTML = "click to go Normal Screen";
      } 
      else 
      {
          if (document.cancelFullScreen) {
              document.cancelFullScreen();
          } else if (document.mozCancelFullScreen) {
              document.mozCancelFullScreen();
          } else if (document.webkitCancelFullScreen) {
              document.webkitCancelFullScreen();
          }
          change.innerHTML = "click to go Full Screen";
      }
  }
  
  &lt;/script&gt;
  &lt;button id="fullscreen" onclick="fullscreen()"&gt;Click to go Full Screen&lt;/button&gt;
  &lt;h1&gt;hi can u see me&lt;/h1&gt;
  &lt;h2&gt;hahahahah&lt;/h2&gt;
  &lt;h3&gt;blablablabla&lt;/h3&gt;
  &lt;h4&gt;heheheheh&lt;/h4&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Based on my code, by default, the screen is not in the full screen mode. If the user click the button, it will go to full screen mode and also the button label will change to view normal screen. But if the user click F11, it will go to fullscreen mode and I want the button to change to view normal mode. Please help me. thank you</p>