Ryanthehouse Ryanthehouse - 2 months ago 25
Javascript Question

Trigger Browser Full Screen Mode via Javascript

When a YouTube video goes full screen, it is relative to the monitor rather than the browser.

How can I trigger a browsers full screen mode to display a webpage relative to the monitor with JS?

Answer

There's a fullscreen browser API in most modern browsers. You can invoke them in Javascript with commands like

if(document.fullscreenEnabled){
    document.getElementById("myimage").requestFullscreen();
}

More info at https://www.sitepoint.com/use-html5-full-screen-api/

Keep in mind you'll have to add much more fullscreen handling code in addition to this.