I want my page to be shown in full screen mode when loaded. I read this article How to make in Javascript full screen windows (stretching all over the screen)
And I am using the suggested solutions/codes for it. But it seems not working. I have the latest version of Chrome and I am sure it supports full screen
mode. But it is still not working.
var elem = document.body; // Make the body go full screen.
requestFullScreen(elem);
function requestFullScreen(element) {
// Supports most browsers and their versions.
var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen;
if (requestMethod) { // Native full screen.
requestMethod.call(element);
} else if (typeof window.ActiveXObject !== "undefined") { // Older IE.
var wscript = new ActiveXObject("WScript.Shell");
if (wscript !== null) {
wscript.SendKeys("{F11}");
}
}
}
I also tried running this code under the load()
event of jQuery
.
$(document).load(function(){
var elem = document.body;
requestFullScreen(elem);
});
but both is not working. Could anyone please tell me what's the cause of this problem? Thank you.