Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
282 views
Welcome To Ask or Share your Answers For Others

1 Answer

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)">

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...