fullscreen javascript code example

Example 1: sfml fullscreen

// This creates a fullscreen window
App.Create(sf::VideoMode(800, 600, 32), "SFML Window", sf::Style::Fullscreen);

Example 2: fullscreen mode javascript

//creating a button and linking it to bClicked()
document.onload=function(){
  documentbody.innerHTML += "<button onclick=\"bClicked()\"></button>"
}

function bClicked(){
  //yourID = the element that you want to fullscreen 
  document.getElementByID("yourID").requestFullscreen();
}

//to exit fullscreen
document.exitFullscreen();

Example 3: put window in fullscreen html

document.documentElement.requestFullscreen();
// or
document.querySelector("#video").requestFullscreen();

Tags:

Html Example