24

I'm trying to create a bookmarklet to do some very specific resizing to do browser size testing, and I can't seem to get the web browser to resize using window.resizeTo.

Overly simplified example that doesn't work:

javascript:window.resizeTo(1024,600);

I can understand that browsers might have disabled this feature, but here's a screenshot of my JavaScript Settings in Firefox:

Advanced JavaScript Settings clearly displaying the "Move or resize existing windows" option as checked

Am I missing something obvious or should I file a bug report?

zzzzBov
  • 174,988
  • 54
  • 320
  • 367

1 Answers1

32

According to this bug report, this is a new feature, not a bug. Specifically:

Two rules:

  1. Can't resize a window/tab that hasn't been created by window.open.
  2. Can't resize a tab if the tab is in a window with more than one tab.

If I understand this "fix" correctly, you can resize only your own popup windows, not the main window.

Viktor
  • 3,436
  • 1
  • 33
  • 42
  • 1
    Then why doesn't `var w=window.open("","","width=100,height=100");w.resizeTo(1024,600);` work? – zzzzBov Sep 29 '11 at 19:26
  • 2
    @zzzzBov: Have Firebug installed? Seems there's a bug which interferes with the browser somehow - see comments [here](https://bugzilla.mozilla.org/show_bug.cgi?id=565541#c45) and [here](https://bugzilla.mozilla.org/show_bug.cgi?id=565541#c47). And according to [this comment](https://bugzilla.mozilla.org/show_bug.cgi?id=565541#c49), a patch is already committed. – Viktor Sep 29 '11 at 19:36
  • FF took away the ability to use javascript: in the address bar as well, gotta use their Scratchpad. what a pain... window resizing and moving also doesn't work in IE8+. thought I was going mad until I read those "bug" reports. – Matt K Nov 03 '11 at 21:57
  • I wish they had added some way to specify geometry from the command line before adding this "feature" – Bryan Agee Mar 22 '12 at 06:01
  • i can't resize the parent window...so I open a smaller window, but this smaller window needs to know about all the other windows that are open. – chovy Aug 26 '16 at 08:26