CancelImage Upload

How to move a browser window to a specified screen location

The following code should only be applied to target blank or pop-up windows, since it requires that the window has not already taken up 100% of the screen's width and height. However, if this isn't the case, the following function can be very useful indeed if you require a smaller window to be placed in a very specific location.

Here is the function that you will be using. X is the horizontal position, while y is the vertical alignment. The coordinates 0, 0 start in the top left corner of your screen:

window.moveTo(x, y);

Window naturally enough can also be replaced with the name of a pop-up window. Here is how you gain complete control:

newWindow = window.open('', '', 'width=300,height=300');

newWindow.moveTo(x, y);

Here then a more extensive example of moving the current window that the code is placed in, instead of accessing a remote window:

<html>
<head>
<title>How to move a browser window to a specified screen location</title>
</head>
<body onload="window.moveTo(50,50);">

</body>
</html>


Login
Want to leave a comment?

No problem. Just enter your email and password below.


register | home | reminder

myDesignTool Networking • www.mydesigntool.cominfo@mydesigntool.com