Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

How can I get Javascript moveTo and resizeTo bookmarklets working again?

  • 24 replies
  • 190 have this problem
  • 6 views
  • Last reply by jdvb

more options

Years ago, a Lifehacker article gave me exactly what I needed: a quick and simple way to resize the various Firefox windows I need open at my office to make them precisely the size and position I need them. — http://lifehacker.com/292901/resize-firefox-with-a-bookmarklet

Unfortunately, upgrading to Firefox 7 seems to prevent these bookmarklets from working. What do I need to do to get them up and running again? It might sound unusual, but this is a critical issue for me. I've downgraded to 6.0.2 until I find a solution that works.

Modified by mgrad92

All Replies (20)

more options

I tried that resize bookmarklet. It does not work. I used bookmarklets that change the colours on web pages, and those do work. Perhaps there is something about that code that Firefox does not recognize as valid?

more options

The resize bookmarklets are broken because of this change: Bug 565541 - Web sites shouldn't be allowed to resize main window

I don't know of a way to make the bookmarklets work again, but here's an add-ons that might help instead: https://addons.mozilla.org/en-US/firefox/addon/firesizer/

more options

Glancing at the Firesizer page on addons.mozilla.org, it's not even compatible with Firefox 7. From what I can tell at first glance, it doesn't seem to reposition windows, anyway.

Surely someone knows a way to get this function back — I can't believe anyone would think it a good idea to just sweep away bookmarklets. Upgrading to Firefox 7 isn't even a question for me until I can figure this out.

more options

The bookmarklets I've been using essentially follow this format:

javascript:moveTo(1,1);resizeTo(1260,screen.availHeight)

They work fine in Firefox 6.0.2, but not in 7 — apparently because someone thought it was a "bug" that someone should want to use bookmarklets to set up their work environment: Bug 565541 - Web sites shouldn't be allowed to resize main window

more options

-> click Firefox button and click Preferences (Options) -> Content panel -> place Checkmark on Enable JavaScript -> click Advanced button -> place checkmark on all Advanced JavaScript settings -> click OK

-> click OK on Options window -> Restart Firefox

Check and tell if its working.

JavaScript

more options

You can run this code in the Firefox > Web Developer > Error Console and click the Evaluate button.


var Cc=Components.classes, Ci=Components.interfaces;
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
var nb = wm.getMostRecentWindow("navigator:browser");
nb.window.moveTo(1,1);nb.window.resizeTo(1260,screen.availHeight);
more options

These advanced javascript settings were already clicked. Still did not work.

more options

Your code did work when "evaluated", but how do you get that code in to menu bar?

more options

You can't, you can only run that code via the Error Console or via an extension (Keyconfig, custom buttons, mouse gesture) that has elevated privileges to run code at chrome level.

more options

in the url bar, enter "about:config" and filter for the key "services.sync.prefs.sync.dom.disable_window_move_resize" and change that value to false to get the old behavior back.

more options

That is the pref that sync uses to synchronize prefs: services.sync.prefs.sync.dom.disable_window_move_resize

You need the main pref dom.disable_window_move_resize to have effect in your current Firefox profile.
This makes you vulnerable to websites that change the current browser window.

more options

Thanks, cor-el, that looked like it was working great — until it stopped working at all. (At exit/relaunch, maybe?) I've got dom.disable_window_move_resize and services.sync.prefs.sync.dom.disable_window_move_resize both set to "false" currently, and my JavaScript moveTo and resizeTo bookmarklets still aren't working.

For what it's worth, I don't think vulnerability is an issue, in my case. My moveTo and resizeTo bookmarklets were working right up through FF 6.0.2, and I never experienced any problems with websites changing my browser windows. (I'll bet 85-90 percent of my time in Firefox is spent using my newspaper company's in-house Web publishing CMS thin client, tho', so I don't imagine I'd hit many abusive sites, anyway.)

Modified by mgrad92

more options

This is not a bug but a feature.

I use this FEATURE in all my in-house apps, from accounting, billing, client records, reports, testing of websites, personal websites, hundreds of thousands lines of code.

Why would you remove a feature and not make a way for the end user to override the setting and let the USER choose to have a feature.

If all manufactures of products tried to "protect" their clients from harm you would not be able to do much.

Anything can be used for purposes that they are not designed or intended for. But that is up to the end user not necessarily the manufacturer.

I use the web browser more for in-house apps for cross-computer-operation system-versions compatibility. It is faster and easier that writing code in C# or VBS to create a useful application.

As for malicious websites, I know they are out there, have visited a couple, but with all the new features of anti-virus software screening websites before you visit has greatly reduced those attacks.

And for every lock there will be a expert locksmith.

So, again why are YOU choosing for ME to stop or not allow a function that is more useful than harmful? Did I promote you to a person that has control of my life?

I will be downgrading to version 6 and staying there until a sane resolution to this problems is made, if at all...

more options

I've seen a web site that alters the window size ... annoying.

Bank of America has a "help us now by completing a survey" button, which I click accidentally once in a while. It opens a survey in a pop-up window. But I have FF set to open pop-ups (at least those that are not blocked) in another tab ... not a pop-up window. The web site doesn't know that, so when it resizes the pop-up-that's-really-just-a-tab, it resizes the whole window.

That's annoying. So it's nice to NOT have this behavior in FF v7. But, like others, I have a resize bookmark ... and it stopped working. So I reverted to FF 6.0.2. I'll tolerate the occasional Bank of America flub in order to regain my resize button.

more options

Having a workround that relies on users changing their settings is rubbish. A web site is supposed to be universal.

Surely, it is not beyond the wit of man to offer a browser option like allowing popups! The default can be either way.

more options

Couldn't agree more! This IS - or was! - a FEATURE ... a USEFUL feature. Firefox designers should NOT destroy this perfectly good - and VERY useful! - feature. Or if they insist on doing so, at least provide a way - e.g. in Preferences - for us to restore this feature that we didn't want to loose in the first place!

more options

Thanks zuzzabuzz. But there's something else going on that's even more bizarre: 1. Went to about:config and switched services.sync.prefs.sync.dom.disable_window_move_resize to false as you suggested. Thereafter, javascript window resizing DID work. Until I quit and restarted - at which it stopped working. 2. Again went to about:config. Without doing ANYTHING else - javascript window resizing started working again. Until I quit and restart. BIZARRE!

more options

The problem seems to be related to Firebug, no more problems after disabling. Firebug 1.8.3 / FF7.0.1 / Windows XP

http://code.google.com/p/fbug/source/detail?r=11993 fixe is fine

Modified by thierry.l

more options

This change is a design defect. So-called bug 565541 "Web sites shouldn't be allowed to resize main window" is a false assertion for two reasons:

1) it is a feature of Javascript that the browser window can be resized and repositioned. 2) There is no formal definition of "main" window. There can be multiple windows, and a script run in one can open another; that makes "parent" and "child" window relationships but there is no such thing as "main".

My copy, Firefox 7.0.1 which is still the latest according to its "check for updates" has the option to disable resizing or repositioning under Tools | Options | Content | Advanced.

The defect is that enabling move or resize in that Advanced Javascript Settings panel fails. If we also have this "about:config" route to settings, and those are not the same settings as those reached from the panel as above, and the about:config overrides the Advanced Javascript Settings panel, then that is a defect and it must be fixed. It is totally improper for a setting under the control of a normal settings panel in a piece of software to be overridden by a separate hidden setting that does exactly the same thing.

If you want to improve Firefox as regards these powers, by all means add to the number of check boxes on the Advanced Javascript Settings panel.

Instead of just "Allow scripts to [] move or resize existing windows [] raise or lower windows etc."

you might wish to have "Allow scripts to [] move or resize the existing window they are running in [] move or resize existing windows other than the one they are running in [] open, move and resize new (popup) windows [] raise or lower windows etc."

However to leave the Advanced Javascript Settings panel with the options it still has but to ignore its settings is totally wrong and it was unacceptable for Firefox 7.0.1. to have gone out like this.

more options

services.sync.prefs.sync.dom.disable_window_move_resize set to false

suggested by zuzzabuzz works if you click on a bookmark, but is useless for invoking keyword shortcuts at the location bar. Putting 27 resize bookmarklets into a folder as a drop-down menu on bookmarks bar where they can have full titles is not much of a solution. One of my reasons for switching to Firefox was to remove limitations on bookmarklets (IE limited size), I did not switch to Firefox because I wanted to compromise.

Modified by David McRitchie

  1. 1
  2. 2