Name

Screen — information about the display screen

Synopsis

The screen property of a Window refers to a Screen object. The properties of this global object contain information about the computer monitor on which the browser is displayed. JavaScript programs can use this information to optimize their output for the user’s display capabilities. For example, a program can choose between large and small images based on the display size.

Properties

readonly unsigned long availHeight

Specifies the available height, in pixels, of the screen on which the web browser is displayed. This available height does not include vertical space allocated to permanent desktop features, such as a bar or dock at the bottom of the screen.

readonly unsigned long availWidth

Specifies the available width, in pixels, of the screen on which the web browser is displayed. This available width does not include horizontal space allocated to permanent desktop features.

readonly unsigned long colorDepthreadonly unsigned long pixelDepth

These synonymous properties both specify the color depth of the screen in bits per pixel.

readonly unsigned long height

Specifies the total height, in pixels, of the screen on which the web browser is displayed. See also availHeight.

readonly unsigned long width

Specifies the total width, in pixels, of the screen on which the web browser is displayed. See also availWidth.

Get JavaScript: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.