What is the best way to set the size of the browser window when the page loads? I think this can be done in JavaScript. Please explain. Here is my code that is not working!
<html>
<body onload="window.resizeTo(640,480)">
<video src="rushmore.mp4" controls="controls">
your browser does not support the video tag
</video>
</body>
</html>
Press Alt+Space to bring up the window menu, press S to choose the Size option, use the arrow keys to resize the window, and lastly Enter to confirm. Click the Maximize button in the top right corner of the window. Click the title bar and drag the window to the left, top, or right edge of the desktop.
The resizeTo() method is used to resizes a window to the specified width and height. Parameter Values: width: Sets the width of the window, in pixels. height: Sets the height of the window, in pixels.
Use window. innerWidth and window. innerHeight to get the current screen size of a page.
This should do the trick, setting the height and width to your desired dimensions.
window.resizeTo(500,500)
You could set it onload
.
<body onload="window.resizeTo(500,500)">
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