5

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

Zakaria
  • 14,892
  • 22
  • 84
  • 125

3 Answers3

5

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.

Michel
  • 9,220
  • 13
  • 44
  • 59
  • I want to underline this solution, because this is exactly how you solve this problem. If you create the window yourself, a whole suite of functions including `resizeTo`, `resizeBy`, `moveBy`, and `moveTo` (and perhaps more) become available to you in the `window` object. – drewww Nov 09 '11 at 23:21
5

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.

Guffa
  • 687,336
  • 108
  • 737
  • 1,005
  • Yeah, I *thought* this was because of Chrome's and Opera's philosophy of having everything in tabs. – Pekka Sep 04 '10 at 09:31
  • @jave.web: It's hard to see what's important in that answer, as about half of the text has emphasis. In what way is it that you think that the answer is not true? – Guffa Mar 07 '16 at 13:09
  • @Guffa I used quotes = I literally meant "Important notes"... and the answer has headings&only important things are emphasised so it is very clear. However I am sorry, because I think I misread your answer (I did not down vote anyway) - you should definitely emphasise "**feel**" "**disabled, or at least a user controllable option.**" – jave.web Mar 08 '16 at 08:24
  • For info on when it is mostly not possible to resize the window see "**Important notes:**" in this answer: http://stackoverflow.com/a/35801906/1835470 – jave.web Mar 08 '16 at 08:29
0

Because many webmasters have made a bad use of pop-ups and resizing, some uncompromising browser manufacturers hopelessly just disable these functions. Other more respectful manufacturers leave them as optional.

user2931920
  • 189
  • 1
  • 2