How can I full-screen browser window after loading the page? I have used code like below in jQuery but its working only using the event click; but I want that to be worked on load.
jQuery(document).ready(function($) {
function fullScreen(){
var docElm = document.documentElement;
if (docElm.requestFullscreen) {
//alert("requestFullscreen");
docElm.requestFullscreen();
}
else if (docElm.mozRequestFullScreen) {
//alert("mozRequestFullScreen");
docElm.mozRequestFullScreen();
}
else if (docElm.webkitRequestFullScreen) {
//alert("webkitRequestFullScreen");
docElm.webkitRequestFullScreen();
}
}
});
Make the browser window fullscreen On a Windows computer, you can set Google Chrome, Internet Explorer, Microsoft Edge, or Mozilla Firefox to full-screen mode, hiding the toolbars and address bar by pressing the F11 key.
Solution 1 Tell him/her to press F11 on the keyboard and the browser window will become full screen.
The "F11" key toggles back and forth between full-screen and standard modes in all major Web browsers, including Internet Explorer.
var elem = document. getElementById("myvideo"); /* When the openFullscreen() function is executed, open the video in fullscreen.
from https://wiki.mozilla.org/Gecko:FullScreenAPI#Suggested_UA_Policy
..requestFullScreen while the window is already in the full-screen state is approved. Otherwise, requestFullScreen outside a user action (e.g. a non-synthesized input event handler) is denied.
so it's not possible force a fullscreen if it's not triggered by a user action
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With