Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The javascript "resizeTo" function not working in Chrome and Opera

The resizeTo (that allows setting a new height/width value) function works great on Firefox and Internet Explorer and doesn't work at all on Chrome and Opera.

Is there another function that does the same and works on all the browsers?

Thank you,

Regards

like image 951
Zakaria Avatar asked Sep 04 '10 09:09

Zakaria


2 Answers

No, there isn't another function.

The resizeTo method is disabled by default in several browsers, and I know that it can also be manually disabled in Firefox.

It has been widely misused, so most browser vendors feel that it should be disabled, or at least a user controllable option.

like image 64
Guffa Avatar answered Oct 08 '22 15:10

Guffa


On my way it isn't possible to resize the window when it is on top-level. (so not a pop-up)

And i think that chrome got it right by not allowing top level windows to be resized.

You can solve it:

Resizing won't work for top-level tabs, and when you open sample.htm it's opened as a top-level tab. If you instead opened it as a pop-up (for example using window.open with a width and a height set), resizeTo should work.

like image 20
Michel Avatar answered Oct 08 '22 14:10

Michel