Javascript 或 jQuery 自动调整大小脚本
因此,在低于 7 的 Firefox 版本中,该脚本可以正常工作(它可以将浏览器窗口的大小调整为最大访问者监视器)。现在在 FF 7+ 中似乎不起作用。如果您能找出它不起作用的原因,或者如果您能给我类似的,我将非常感激!这是我的代码:
<script language="JavaScript1.2">
top.window.moveTo(0,0);
if (document.all) {
top.window.resizeTo(screen.availWidth,screen.availHeight);
}
else if (document.layers||document.getElementById) {
if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth){
top.window.outerHeight = screen.availHeight;
top.window.outerWidth = screen.availWidth;
}
}
</script>
So in Firefox versions lower than 7 this script was working (it is auroresizing the browser window to maximum of visitors monitor). Now in FF 7 + it seems that it is not working. If you can find out why it is not working, or if you can give me similar one i will be fery very thankful! Here is my code:
<script language="JavaScript1.2">
top.window.moveTo(0,0);
if (document.all) {
top.window.resizeTo(screen.availWidth,screen.availHeight);
}
else if (document.layers||document.getElementById) {
if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth){
top.window.outerHeight = screen.availHeight;
top.window.outerWidth = screen.availWidth;
}
}
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自精细手册:
window.outerWidth
也是如此。有resizeTo
和resizeBy
但浏览器不一定会关注你的请求。浏览器窗口的大小是用户的选择,调整窗口大小有点粗鲁,因此许多浏览器不允许您这样做。
From the fine manual:
The same holds for
window.outerWidth
. There isresizeTo
andresizeBy
but the browser won't necessarily pay attention to your humble request.The size of the browser window is the user's choice and resizing their window is a bit rude so many browsers won't let you do it.