title: How to Open a link (web page) in fullscreen mode, javascript?
body: <p>simply I need to open a new page in fullscreen.</p>
  <p>So, users press a button and then a video (hidden on main page) is open in fullscreen and start to play. When user press button to close fullscreen or press &quot;esc&quot; key, video will pause, fullscreen is closed and iframe is not visible...</p>
  <p>I'm try to get this demo works, but with no results.
  Also I can make it works only if I open only the video element, not iframe...</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>const fullscreen   =  document.querySelector('.playnow');
  const video        =  document.querySelector('#myvideo');
  
  fullscreen.addEventListener('click', toggleFullScreen);
  
  // Create fullscreen video button
  function toggleFullScreen() {
  
      if(video.requestFullScreen){
          video.requestFullScreen();
      } else if(video.webkitRequestFullScreen){
          video.webkitRequestFullScreen();
      } else if(video.mozRequestFullScreen){
          video.mozRequestFullScreen();
      };
      video.classList.remove("d-none");
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>body{
    margin:0;
    padding:0;
  }
  .video-container{
    width:100%;
    height:100vh;
    margin: 0 auto;
    position:relative;
    background-image: url(https://images.unsplash.com/photo-1616485828923-2640a1ee48b4?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&amp;ixlib=rb-1.2.1&amp;auto=format&amp;fit=crop&amp;w=3150&amp;q=80);
    background-repeat:no-repeat;
    background-size:cover;
    background-position: center;
  }
  
  #myvideo{
   
  }
  
  .d-none{
    display:none;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="video-container"&gt;
    &lt;button class="playnow"&gt;Open Video in Fullscreen Mode&lt;/button&gt;
  
  
    &lt;video width="100%" autoplay id="myvideo" class="d-none"&gt;   
        &lt;source src="//d2zihajmogu5jn.cloudfront.net/big-buck-bunny/master.m3u8" type="video/mp4"&gt;
          Your browser does not support the video tag.
      &lt;/video&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>I've tried:</p>
  <ul>
  <li><p><a href="https://gomakethings.com/how-to-play-a-video-in-full-screen-mode-when-its-thumbnail-is-clicked-with-vanilla-js/" rel="nofollow noreferrer">https://gomakethings.com/how-to-play-a-video-in-full-screen-mode-when-its-thumbnail-is-clicked-with-vanilla-js/</a>  (better demo, but video still visible after fullscreen is closed...)</p>
  </li>
  <li><p><a href="https://www.hongkiat.com/blog/html5-fullscreen-api/" rel="nofollow noreferrer">https://www.hongkiat.com/blog/html5-fullscreen-api/</a></p>
  </li>
  </ul>
  <p>But no appreciable results.</p>
  <p>Thank you, Luca</p>