Javascript 设置浏览器窗口大小
页面加载时设置浏览器窗口大小的最佳方法是什么? 我认为这可以用 JavaScript 来完成。请解释一下。这是我的代码不起作用!
<html>
<body onload="window.resizeTo(640,480)">
<video src="rushmore.mp4" controls="controls">
your browser does not support the video tag
</video>
</body>
</html>
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这应该可以解决问题,将高度和宽度设置为您想要的尺寸。
您可以将其设置为
onload
。This should do the trick, setting the height and width to your desired dimensions.
You could set it
onload
.由于评论太长,我将其放入答案中。
我发现的唯一接近调整 chrome 窗口大小的方法是使用可以调整窗口大小的 chrome 扩展。
实际的扩展命令是
chrome.windows.update(...)
。请查看此处。
但我不确定这就是您正在寻找的。
如果您仍然感兴趣,至少有 2 个扩展可以做到这一点,我已经看到尝试这个
快乐,祝你好运!
I put this in an answer as the comment became to long.
The only thing that I have found that is close to the resizing of the chrome window is to use a chrome extension that can resize the window.
The actual extension command is
chrome.windows.update(...)
.Take a look here.
But I am not sure this is what you are looking for.
If it still interests you there are at least 2 extensions that can do this, that I have seen try this one
Be happy and good luck!