When a new window is opened its position with respect to currently viewed window (viewport) can be set in JavaScript. The x and y coordinates of the new window are returned with screenX or screenLeft and screenY or screenTop properties. These property names are browser specific, i.e. screenLeft, screenTop are for IE8 and before, screenX, screenY are for other browsers.

Example of reading window's coordinates with browser object model (BOM)


›› go to examples ››