Window screenX
Example
Open a new window with a specified left and top position, 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 »
More examples below.
Definition and Usage
The screenX
property returns the x (horizontal) coordinate of a window,
relative to the screen.
Syntax
window.screenX
or just:
screenX
Parameters
NONE |
Return Value
Parameter | Description |
A number | The horizontal distance of the window relative to the screen, in pixels |
More Examples
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 »
Browser Support
window.screenX
is supported in all browsers:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | 10-11 | Yes | Yes | Yes | Yes |