codingtcher.com
Theme Night
Home
Login

How to make the window full screen with Javascript

Home » Tutorial Post » How to make the window full screen with Javascript
<button onclick="openFullscreen();">Click to here and open Fullscreen Mode</button>

<script>
var elem = document.querySelector("body");
function openFullscreen() {
  if (elem.requestFullscreen) {
    elem.requestFullscreen();
  } else if (elem.webkitRequestFullscreen) { /* Safari */
    elem.webkitRequestFullscreen();
  } else if (elem.msRequestFullscreen) { /* IE11 */
    elem.msRequestFullscreen();
  }
}
</script>

Related Post