How to open a web page automatically in full screen mode
For Chrome via Chrome Fullscreen API
Note that for (Chrome) security reasons it cannot be called or executed automatically, there must be an interaction from the user first. (Such as button click, keydown/keypress etc.)
addEventListener("click", function() {
var
el = document.documentElement
, rfs =
el.requestFullScreen
|| el.webkitRequestFullScreen
|| el.mozRequestFullScreen
;
rfs.call(el);
});
Javascript Fullscreen API as demo'd by David Walsh that seems to be a cross browser solution
// Find the right method, call on correct element
function launchFullScreen(element) {
if(element.requestFullScreen) {
element.requestFullScreen();
} else if(element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if(element.webkitRequestFullScreen) {
element.webkitRequestFullScreen();
}
}
// Launch fullscreen for browsers that support it!
launchFullScreen(document.documentElement); // the whole page
launchFullScreen(document.getElementById("videoElement")); // any individual element
Enter full screen automatically by inserting script in a webpage using requestly
TLDR; This is not possible to auto-trigger full-screen mode using Script Insertion. It has to be based on user Interaction.
As per requestFullscreen MDN documentation
This method must be called while responding to user interaction or a device orientation change; otherwise, it will fail.
I tried triggering an automatic click on a button dynamically inserted into the page but we get the same error.
Here's the Insert Script Rule I created in Requestly
How to make the window full screen with Javascript (stretching all over the screen)
This is as close as you can get to full screen in JavaScript:
<script type="text/javascript">
window.onload = maxWindow;
function maxWindow() {
window.moveTo(0, 0);
if (document.all) {
top.window.resizeTo(screen.availWidth, screen.availHeight);
}
else if (document.layers || document.getElementById) {
if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth) {
top.window.outerHeight = screen.availHeight;
top.window.outerWidth = screen.availWidth;
}
}
}
</script>
Related Topics
Javascript Add Class Active When Click a Link After Load Another Page
Laravel Pdf File Download from Ajax Request (Laravel 5)
How to Make a Modal Popup to Take an Input Value Using Jquery or JavaScript
Generate and Download CSV File With PHP and Ajax
Javascript, Track Iframes Redirecting Top Window
How to Get Multiple Comma Separated Values from Url
Jquery Ajax Readystate 0 Responsetext Status 0 Statustext Error
Using Js Remove Comma from Number from Existing Data
How to Parse Excel (Xls) File in Javascript/Html5
Syntaxerror: Cannot Use Import Statement Outside a Module
How to Compare Two Arrays Using Lodash (The Order Matters)
How to Create a Horizontal Scrolling Chart.Js Line Chart With a Locked Y Axis
Detect If Page Is Load from Back Button
How to Return Blank String If Object Is Undefined in Angularjs Forms
Javascript Dashes in Phone Number
Progressive Web App - Service Worker Not Serving Start_Url
Get Start Date and End Date of Current Week (Week Start from Monday and End With Sunday )