Javascript 窗口调整大小在 Safari 中不起作用,但在 Firefox 中起作用
我有这个基本的 javascript 代码:window.resizeTo(1000,800)
设置为在页面加载时运行,并且它在 Firefox 中完美运行,但在 Safari 中则不然。
提前致谢!
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.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
浏览器有意地阻止了此操作。请不要尝试调整用户窗口的大小,这只会导致他们用沙拉叉追捕您。
请记住,大多数浏览器默认使用选项卡,是什么让您的网站有权调整我的其他选项卡的大小?当您从用户的角度考虑时,您应该明白为什么浏览器制造商有意开始阻止这种不需要的行为(至少在顶部/选项卡级别,调整您自己页面内所需内容的大小,例如
)。
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, e.g. an
<iframe>
).