Html 我不希望弹出窗口可以调整大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8216208/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 11:36:33  来源:igfitidea点击:

I don't want pop up window to be resizable

htmlcssbrowser

提问by BruceyBandit

I have a popup window which appears after clicking on a button. I don't want the pop up window though to be resizeable. I tried using in css resize:noneand resizable:nonebut this does not work for all browsers.

我有一个弹出窗口,单击按钮后会出现该窗口。我不希望弹出窗口可以调整大小。我试着用CSSresize:noneresizable:none,但这并不适用于所有浏览器。

Is there a css element that can be used so that pop window can not resizable in all browsers, or is there a lot of different ressizeable related css elements so that I can use them so eventually all pop up windows are not resizable in all broswers?

是否有可以使用的 css 元素,以便无法在所有浏览器中调整弹出窗口的大小,或者是否有许多不同的可调整大小的相关 css 元素,以便我可以使用它们,因此最终所有弹出窗口都无法在所有浏览器中调整大小?

I know where to put the css elements, in the window.open function, I just want to know other css ways that can make pop up windows not resizable for all browsers

我知道在 window.open 函数中将 css 元素放在哪里,我只想知道其他 css 方法可以使弹出窗口无法为所有浏览器调整大小

Browsers using (all latest browsers): IE, Firefox, Google Chrome, safari and Opera

使用的浏览器(所有最新浏览器):IE、Firefox、Google Chrome、safari 和 Opera

回答by James Hill

You can't do this with CSS - you need to pass the resizableparameter to your window.open()function. If you're using an anchorwith the targetattribute, you need to use JavaScript instead.

你不能用 CSS 做到这一点 - 你需要将resizable参数传递给你的window.open()函数。如果您使用anchor带有target属性的 ,则需要改用 JavaScript。

JS Example

JS 示例

window.open ("http://URL","mywin","menubar=1,resizable=0,width=350,height=250");

JS & HTML Example

JS 和 HTML 示例

<a href="#"
  onclick="window.open ('http://URL','mywin','resizable=0,width=350,height=250')">Open</a>

Additional Resources

其他资源

Take a look at the window.opendocs on MDN: https://developer.mozilla.org/en/DOM/window.open

查看window.openMDN上的文档:https: //developer.mozilla.org/en/DOM/window.open

According to MDN, Firefox will not support the resizable attribute:

根据 MDN,Firefox 将不支持 resizable 属性:

resizable

If this feature is set to yes, the new secondary window will be resizable. Note: Starting with version 1.4, Mozilla-based browsers have a window resizing grippy at the right end of the status bar, this ensures that users can resize the browser window even if the web author requested this secondary window to be non-resizable. In such case, the maximize/restore icon in the window's titlebar will be disabled and the window's borders won't allow resizing but the window will still be resizable via that grippy in the status bar.

Starting with Firefox 3, secondary windows are always resizable ( bug 177838)

可调整大小

如果此功能设置为 yes,则新的辅助窗口将可调整大小。注意:从 1.4 版开始,基于 Mozilla 的浏览器在状态栏的右端有一个可调整大小的窗口,这确保用户可以调整浏览器窗口的大小,即使网络作者要求此辅助窗口不可调整大小。在这种情况下,窗口标题栏中的最大化/恢复图标将被禁用,窗口的边框将不允许调整大小,但窗口仍可通过状态栏中的抓地力调整大小。

从 Firefox 3 开始,辅助窗口始终可以调整大小(错误177838

回答by Patricia

Firefox doesn't support this.

Firefox 不支持此功能。

have a look here:

看看这里:

how can we disable resizing of new popup window in firefox?

我们如何在 Firefox 中禁用调整新弹出窗口的大小?

futher more, it's a bad idea to make it not-resizeable. what if your users are visually impaired have have there settings to have large fonts?

此外,使其不可调整大小是一个坏主意。如果您的用户有视力障碍,有设置大字体怎么办?