Sometimes, we want to open maximized window with JavaScript.
In this article, we’ll look at how to open maximized window with JavaScript.
How to open maximized window with JavaScript?
To open maximized window with JavaScript, we call window.open
with a string with options.
For instance, we write
const params = ["height=" + screen.height, "width=" + screen.width].join(",");
const popup = window.open("http://www.google.com", "popup_window", params);
popup.moveTo(0, 0);
to call window.open
with the params
string that sets the height to the screen’s height and the width to the screen’s width.
And then we call moveTo
to move the window to the top left corner of the screen.
Conclusion
To open maximized window with JavaScript, we call window.open
with a string with options.