Ben Holness
Ben Holness

Reputation: 2707

Is it possible to create a full screen HTML popup, like a full screen video player?

I would like to create a similar experience to a full screen video player, that extends outside of the browser to the full monitor height and width, but with an HTML basis (i.e. I can put in a background and buttons and use CSS to present it to the user).

Is this possible? I'm thinking HTML/CSS/Javascript, but open to any technology.

Upvotes: 1

Views: 1237

Answers (1)

Dan Knights
Dan Knights

Reputation: 8368

To make something fullscreen using JS you have to use the requestFullscreen() method.

From this article:

/* Get the element you want displayed in fullscreen mode (a video in this example): */
var elem = document.getElementById("myvideo");

/* When the openFullscreen() function is executed, open the video in fullscreen.
Note that we must include prefixes for different browsers, as they don't support the requestFullscreen property yet */
function openFullscreen() {
  if (elem.requestFullscreen) {
    elem.requestFullscreen();
  } else if (elem.mozRequestFullScreen) { /* Firefox */
    elem.mozRequestFullScreen();
  } else if (elem.webkitRequestFullscreen) { /* Chrome, Safari and Opera */
    elem.webkitRequestFullscreen();
  } else if (elem.msRequestFullscreen) { /* IE/Edge */
    elem.msRequestFullscreen();
  }
}

Upvotes: 1

Related Questions