Home >Web Front-end >JS Tutorial >js maximizes the browser window implementation code (applicable to IE)_javascript skills
The method used here is a private feature of IE and is only valid in IE. Mainly the window.moveTo and window.resizeTo methods.
The effect is similar to clicking the maximize button, with one difference. After clicking the maximize button, the content of the browser fills the monitor and the borders of the browser window are squeezed out of the monitor. The maximized effect of this js is that the browser's border is displayed within the monitor.
js code is as follows:
function resizeWindow(){
if (window.screen) {//Determine whether the browser supports window.screen Determine whether the browser supports screen var myw = screen.availWidth; //Define a myw and receive the width of the current full screen. var myh = screen.availHeight; //Define a myw and receive the height of the current full screen. window.moveTo(0, 0); //Move The window is placed on the upper left corner window.resizeTo(myw, myh); //Jump the length and width of the current window to myw and myh } }
The body of the html uses the onload event to call this function: