If you want to make something go fullscreen using JavaScript, you need to utilize the requestFullscreen()
method.
According to information sourced from this particular source:
/* Identify the element that should be displayed in fullscreen mode (e.g., a video in this case): */
var element = document.getElementById("myvideo");
/* Upon executing the openFullscreen() function, trigger the fullscreen display of the video.
Keep in mind that different browser prefixes are necessary as not all browsers currently support the requestFullscreen property. */
function openFullscreen() {
if (element.requestFullscreen) {
element.requestFullscreen();
} else if (element.mozRequestFullScreen) { /* For Firefox */
element.mozRequestFullScreen();
} else if (element.webkitRequestFullscreen) { /* For Chrome, Safari, and Opera */
element.webkitRequestFullscreen();
} else if (element.msRequestFullscreen) { /* For IE/Edge */
element.msRequestFullscreen();
}
}