简体   繁体   English

Javascript窗口调整大小在Safari中不起作用,但在Firefox中起作用

[英]Javascript window resize doesn't work in Safari but does in Firefox

I have this basic javascript code: window.resizeTo(1000,800) set to run when the page loads and it works perfectly in Firefox but not in Safari. 我有这个基本的javascript代码: window.resizeTo(1000,800)设置为在页面加载时运行,它在Firefox中可完美运行,但在Safari中无法正常运行。

Thanks in advance! 提前致谢!

The browser blocks this, quite intentionally . 浏览器非常有意地阻止了此操作。 Please don't try to resize the user's window , this will only lead to them hunting you down with a salad fork. 不要尝试调整用户窗口的大小 ,这只会导致他们用色拉叉追捕您。

Keep in mind that most browsers by default use tabs, what gives your site the right to resize my other tabs? 请记住,大多数浏览器默认情况下都使用标签页,这使您的网站有权调整其他标签页的大小? When you think about it from the users' point of view, you should see why browser makers have intentionally started blocking this unwanted behavior (at least at the top/tab level, resize what you want inside your own page, eg an <iframe> ). 从用户的角度考虑问题时,您应该了解为什么浏览器制造商有意开始阻止这种不良行为(至少在顶部/标签级,在自己的页面中调整所需大小,例如<iframe> )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM