English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Window screenX property

JavaScript Window Object

screenXa read-only property that returns the horizontal distance from the left edge of the user's browser window to the left edge of the screen (in pixels).

The screenX property is a newerscreenLeftalias of the property.

Syntax:

window.screenX
var win = window.open("", "popupWindow");
win.document.write("<p>This is 'popupWindow'");
win.document.write("<br>ScreenX: " + win.screenX);
win.document.write("<br>ScreenY: " + win.screenY + "</p>
Test and See‹/›

Note: The screenX and screenY properties are equal to the screenLeft and screenTop properties.

Browser compatibility

All browsers fully support the screenX property:

property
screenXisisisisis

Technical details

Return Value:This number is equal to the number of CSS pixels from the left edge of the browser viewport to the left edge of the screen

More Examples

Return the x and y coordinates of the new window relative to the screen:

var win = window.open("", "popupWindow", "left=500, top=350, width=300, height=200");
win.document.write("<p>This is 'popupWindow'");
win.document.write("<br>ScreenX: " + win.screenX);
win.document.write("<br>ScreenY: " + win.screenY + "</p>
Test and See‹/›

Related References

Reference: Window (Window)window.screenY property

Reference: Window (Window)window.screenTop property

Reference: Window (Window)window.screenLeft property

JavaScript Window Object