I'll show you three solutions, each of which has its drawbacks, but I hope that at least one of them is acceptable to you.
JavaScript
This is probably the only useful application of window.resizeTo
. Type
javascript:window.resizeTo(1280,512)
into the address bar. You can turn this in a bookmarklet easily.
Drawbacks
- Doesn't work if you have JavaScript
turned off.
- JavaScript blockers may
interfer (NoScript doesn't though)
- Works with the default settings of Firefox but doesn't if
you have removed the check mark from
Allow scripts to: Move or resize existing windows
under Edit/Preferences/Content/Enable JavaScript/Advanced...
Window Manager
wmctrl -r Firefox -e 0,-1,-1,1280,512
Drawbacks:
- You'll have to have wmctrl installed (there is a wmctrl package for Fedora)
- Requires EWMH/NetWM compatible X Window Manager (default window managers of KDE and GNOME are supported though)
- If you have more than one Firefox window open you will have to specify exactly which one you want to resize. See wmctrl documentation on how you can do this, it's not difficult.
Command Line
The most obvious solution is to start Firefox with the desired window geometry.
It'll start unmaximized but if you maximize and then again unmaximize,
it'll shrink to the size that it had before.
Usually you can determine the window geometry for X Window applications like so:
firefox -geometry 1280x512+0+0
That didn't work for me, so I looked up the Firefox command line options (shortened):
Usage: firefox [ options ... ] [URL]
where options include:
-height <value> Set height of startup window to <value>.
-width <value> Set width of startup window to <value>.
-no-remote Open new instance, not a new window in running instance.
I tried
firefox -no-remote -height 1280 -width 512
but that didn't work either. I think this is a bug in Firefox, and maybe it works in other versions or on other platforms.
Drawbacks
- Neither of the above worked for me with
Firefox 3.0.12 on Ubuntu 9.04.
- It only works as long as you don't change the window size manually.
Not that I know of – a_m0d – 2009-08-15T07:20:04.857
1Interesting. Mine doesn't do that. Are you using any add-ons that might trigger this? – Sasha Chedygov – 2009-07-18T05:37:01.413