Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
599 views
in Technique[技术] by (71.8m points)

html - I don't want pop up window to be resizable

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:none and resizable:none but this does not work for all browsers.

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?

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can't do this with CSS - you need to pass the resizable parameter to your window.open() function. If you're using an anchor with the target attribute, you need to use JavaScript instead.

JS Example

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

JS & HTML Example

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

Additional Resources

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

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

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 )


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...