window.resize javascript function does not work in v7 even though option enabled
Build identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1
[script type="text/javascript"] [!-- window.resizeTo(740, 735); //--] /script
This function no longer resizes popped-out windows even though Options -> Content -> JavaScript Advanced -> Move or resize existing windows is enabled.
Modified
Chosen solution
The solution is kind of cryptic, please show the entire new script. I don't know anything about javascript. Thanks.
Read this answer in context 👍 0All Replies (14)
The Advanced JavaScript setting to move and resize now only applies to pop-up windows and not to the main window.
- Tools > Options > Content : JavaScript > Advanced > Allow Scripts to: [] "Move or resize existing windows"
See https://developer.mozilla.org/en/Firefox_7_for_developers#DOM
- window.resizeTo and window.resizeBy no longer apply to the main window.
- Bug 565541 – Web sites shouldn't be allowed to resize main window
- Bug 690648 – Clarify popup-only move/resize window preference label
(please do not comment in bug reports)
So, if the script is in the pop-out window, then this is considered to be the "main window" and the resize should be called from the calling page? Something like:
winname = window_open('url', 'winname', 'vars'); winname.resizeTo(123, 456);
Modified
Anyone? what denotes a window as not being the "Main Window"?
The meaning of "main window" needs to be clarified. I tried to open a popup window using "window.open" and then tried a "resizeBy()" call on that popup from the parent window, but I got "Error: Permission denied to access property 'resizeTo'".
So, if javascript won't work anymore to let me resize my window, how can I get similar functionality: I really like having a resizer in the upper left bookmark so when the window slides off the screen, I can easily get it back; and can put the desktop in a "normal" format. This seems like a regression to me. Work arounds please? (Yes, I know I can fiddle with the edges by mouse, but I don't like trying to catch the edge with the cursor: my hands don't move smoothly any more)
You can do that with code in the Firefox > Web Developer > Error Console or with an extension like ResizeIT
If you are trying to resize a popup window (opened via window.open()) and not the main window, and it is not working, it could be due to an issue with Firebug.
Disabling Firebug should cause resizing to work again.
My issue is that being unable to programmatically resize/reposition the main window is a regression from functionality that I find to be very valuable. If javascript cannot be used to resize the main window how *can* I do what I used to do with a javascriptlet bookmark? I have motor-control issues that make it much easier to use a bookmark than to grab the edge of the window with the mouse.
Sad to say that even when disabeling firebug my script will no longer resize my image popup window. It does not work on other FF installations that do not have firebug installed either. Niether in safe mode nor in normal mode.
window opened through window.open(....)
You sure you disabled the addon and restarted Firefox completely? I've found that on Windows, the firefox.exe process does not always end properly and sometimes requires an "End Process Tree" from Task Manager.
I also thought, from the bug, this should've been fixed with the 1.8.4 release, but maybe the 8 release of FF stuffed that up.
Chosen Solution
The solution is kind of cryptic, please show the entire new script. I don't know anything about javascript. Thanks.
This js function doesn't work in Firefox v8 either. I'm opening a new window with window.open as follows:
window.open(fullurl, windowName, 'toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes,width=560,height=230');
However, that is the minimum height of the window. I need to be able to allow my users to view additional details in this "Status" window. I've created a toggle control to show/hide progress details and it works in all browsers EXCEPT Firefox 7/8. C'mon. WTF??
This is NOT the main window. It is a window with no controls other than what are IN the window itself. The users of this application need to be able to easily resize the window with the control.
Yes, they drag the window size to be larger but I'm trying to simplify things for them and create a simple user interface.
There is no reason why we shouldn't be able to use javascript to resize children windows opened with window.open.
Sigh.. There have been browser compatibility issues for us developers for years. You'd think at some point they'd be reduced but they seem to increase!
Very frustrating especially when you're on a deadline.
Ok.. it does work in FF8! The previous poster was correct. FireBug hoses it up. You must completely disable the add-on and restart Firefox. You have to make sure that Firefox has completely closed and then reopen it after disabling FireBug. I had Firebug 1.8.4 running and the window.open window would not resize. With it disabled it works as expected.
Sorry for the rant, I've been coding way to long today! :-)
Worked perfectly - thanks very much. Firebug is quite useful so I don't mind the issue - just did not want all of my customers having the same issue ;-)