I was looking for a way to resize and move the browser's window and I've found it:
self.resizeTo(w, h)
and self.moveTo(x, y)
- this seems to work perfectly, but only in Firefox and IE (tested with IE8, don't know how does it work in the previous versions).
How can I force the same behavior (resizing and moving) in Opera and Chrome? In these browsers the above solution does not work at all. Just nothing happens and nothing appears in the error console.
views:
50answers:
1
+1
A:
In Opera and Chrome you can use window.resizeTo(w,h);
but it won't affect maximized tabs (so you can only move and resize popups).
dev-null-dweller
2010-10-07 17:57:17
Thank you for your answer. I've tried it and it doesn't work indeed, so you're right, it will probably work only in popups. That's not what I expected. Thank you anyway. If I won't get any better answer soon, I will accept your one.
rhino
2010-10-07 18:10:19
@rhino: It doesn't work in IE when tabs are enabled either. You simply can't achieve what you want reliably these days.
Tim Down
2010-10-07 21:06:49
@Tim Down: I don't know which version of IE are you talking about, but on my IE8 with tabs enabled everything works just like in Firefox - I can freely resize and move the window by using JS.
rhino
2010-10-07 22:09:54
@rhino: I'm using IE 7. It works when there's only one tab but not if there's more than one.
Tim Down
2010-10-07 22:42:17
You're right, I haven't tried it before. Indeed, if there's more than one tab, just nothing happens.
rhino
2010-10-08 00:47:32
Note that Opera also has two preferences (under content - javascript preferences) named "Allow moving of windows" and "Allow resizing of windows". If these are disabled by the user there is no way the script can get around it.
hallvors
2010-10-12 06:33:20