Reputation: 9
I need help making a webpage. I need to set that page in fullscreen mode, so I have this JavaScript code:
var elem = document.getElementById("fulscreen");
var fs = document.getElementById("body");
elem.onclick = function()
{
req = fs.webkitRequestFullScreen;
req.call(fs);
}
function toggleFullScreen()
{
document.documentElement.requestFullscreen();
}
Where "fulscreen" is a ID of a button and "body" is the ID of the HTML tag then all the page can be in full screen, but there is the problem, the fullscreen mode is activated when i do a click in the button, and I need the webpage in fullscreen automatically... thanks :)
Upvotes: 0
Views: 7295
Reputation:
http://sorcery.smugmug.com/2012/06/06/using-html5s-fullscreen-api-for-fun-and-profit/
Might help, though this function seems to be a morass of incompatibility.
Generally, in js if you want something to happen as soon as the page has loaded, put a call to it in
http://www.w3schools.com/jsref/event_onload.asp
Upvotes: 0