Window screenX Property

Definition and Usage

screenX The property returns the x (horizontal) coordinate of the window relative to the screen.

See also:

screenY property

screenTop property

screenLeft property

Instance

Example 1

Open a new window with specified left and top positions and return its coordinates:

const myWin = window.open("", "", "left=700,top=350,width=200,height=100");
let x = myWin.screenX;
let y = myWin.screenY;

Try it yourself

Example 2

Open a new window and return its coordinates:

const myWin = window.open("", "", "width=200,height=100");
let x = myWin.screenX;
let y = myWin.screenY;

Try it yourself

Syntax

window.screenX

or:

screenX

Parameter

None.

Return Value

Type Description
Number The horizontal distance of the window from the screen in pixels.

Browser Support

All Browsers Support window.screenX:

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Support 10-11 Support Support Support Support