The browser window is an object in JavaScript. The window can be moved by using "windowObject.moveTo(x, y)," Where windowObject is the window that you wish to move, and x and y is the new coordinate for the window. The unit for x and y is pixel.
THE CURRENT WINDOW
The current window (where the JavaScript code is located) is called "window" or "self" or "this." If you're referring to the current window, the windowObject can even be omitted. Here are some examples of moving the current window (you can click on each one to move the current window):
javascript: window.moveTo(100,100);
javascript: self.moveTo(200,200);
javascript: this.moveTo(100,100);
javascript: moveTo(300,300);
To resize window, use "resizeTo(newWidth, newHeight)." Example:
javascript:window.resizeTo(500,300);
ANOTHER WINDOW
To move another window, you need to set the windowObject in windowObject.moveTo(x, y) with the window that you wish to move. Normally, you'll have this object when you're opening a new window with window.open().
Example:
Run this code to open a new window:
javascript: tutorialWindow=window.open('http://www.permadi.com', 'myNewWindow');
That code opens a new window object which is called "tutorialWindow." Now you can resize that window like this:
javascript: tutorialWindow.moveTo(200,200);
Note: you cannot move or resize window that has contents from different domain. Ie: If your page is at a.com, and you open a window and put the content of b.com, then you won't be able to do much with that window.