views:

50

answers:

1

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.

+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
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
@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
@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
@rhino: I'm using IE 7. It works when there's only one tab but not if there's more than one.
Tim Down
You're right, I haven't tried it before. Indeed, if there's more than one tab, just nothing happens.
rhino
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