最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

html - Can I change a non-resizable existing browser window with Javascript to be resizable? - Stack Overflow

programmeradmin0浏览0评论

Simple question, I have a window that was opened with this code

window.open(URL, windowName, 'resizable=no');

I know I can control size and position programmatically after it's loaded but how do I make it simply reziable again? is there any way to override it?

(NOTE: I have no access to modify the opening code, but have full access to the child window code)

Simple question, I have a window that was opened with this code

window.open(URL, windowName, 'resizable=no');

I know I can control size and position programmatically after it's loaded but how do I make it simply reziable again? is there any way to override it?

(NOTE: I have no access to modify the opening code, but have full access to the child window code)

Share Improve this question asked Aug 10, 2011 at 17:54 Eran MedanEran Medan 45.8k61 gold badges187 silver badges281 bronze badges 1
  • did you try setAttribute – zod Commented Aug 10, 2011 at 19:51
Add a ment  | 

5 Answers 5

Reset to default 2

A hack can be this:

window.open(window.location.href, document.title, 'resizable=yes');
window.close();

but it cause your window open a new window and close itself that is not a good UX

You can resize the child window like this:

self.resizeTo(width, height);

As for making the child window resizable again, I don't think you can. The parent window has control of the child.

No, whether a window is resizable is determined when it is opened. Changing this flag after the fact isn't possible. Depending on your goal opening a new (resizable) child window and closing the old one might be an option, I don't think there are any alternatives.

I can't find it in w3c site so this might be deprecated, but window.setResizable(true) should set it's own window resizeable.

Give it a try, check the link for more information on the restrictions.

The method is also listed here.

Of course that, having control over the child, you could also create a new child from it I guess, as a last resort.

var win = window.open(URL, windowName, 'resizable=no');
win.resizeTo(*yourWidth*, *yourHeight*);

you can use resizeTo to your width and height to change the window size

发布评论

评论列表(0)

  1. 暂无评论