Reputation: 4658
On click, unmaximize current browser.
resizeTo()
apparently doesn't work for open tabs on chrome (correct me if I'm wrong).
Was wondering if there was a way to manipulate the window itself.
Upvotes: 0
Views: 82
Reputation: 7029
You can only manipulate a window if you opened it yourself (i.e., via window.open()
).
You could open a copy of the current window by doing this:
var popup = window.open(window.location);
popup.resizeTo(250, 250);
This is for security and user convenience. This way, it's very difficult to create a website that jumps around your screen as soon as it is opened, for example, which would annoy users a lot.
Upvotes: 1
Reputation: 625
This should work:
myWindow = window.open("", "", "width=100, height=100"); // Opens a new window
myWindow.resizeTo(250, 250); // Resizes the new window
The resizeTo method for current browser window is disabled by default in several browsers, and I know that it can also be manually disabled in Firefox. It has been widely misused, so most browser vendors feel that it should be disabled, or at least a user controllable option.
Upvotes: 0