简体   繁体   English

在FireFox中使用JavaScript最大化弹出窗口

[英]Maximize a popup with JavaScript in FireFox

I'm maximizing a popup with the following JavaScript function: 我正在使用以下JavaScript函数来最大化弹出窗口:

 function expandWindow() {
    window.moveTo(0, 0);
    window.resizeTo(screen.width, screen.height);
   }

This code works fine in IE and Chrome. 此代码在IE和Chrome中可以正常运行。 However it does not work in FireFox. 但是,它在FireFox中不起作用。 I've checked and in the FireFox settings it is allowed for the scripts to resize and move windows. 我检查了一下,并在FireFox设置中允许脚本调整大小和移动窗口。 However that code does nothing in FireFox. 但是,该代码在FireFox中不起作用。 Could anybody help me to figure out what the problem is and how to fix this for FireFox? 有人可以帮我弄清楚问题是什么以及如何为FireFox解决此问题吗?

Thanks. 谢谢。

From the Firefox 7 announcement : Firefox 7公告

It's no longer possible for a web site to change the default size of a window in a browser, according to the following rules: 根据以下规则,网站不再可能更改浏览器中窗口的默认大小:

  • You can't resize a window or tab that wasn't created by window.open. 您无法调整非window.open创建的窗口或选项卡的大小。
  • You can't resize a window or tab when it's in a window with more than one tab. 当窗口或选项卡位于具有多个选项卡的窗口中时,无法调整其大小。

See also the (recently updated) MDC entry for window.resizeTo . 另请参阅window.resizeTo的(最近更新的) MDC条目

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

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