JavaScript screen gets information about the client display

Source: Internet
Author: User

The Screen object contains information about the client display screens.
The screen property of each Window object refers to a screen object. The screen object holds information about displaying the browser's screens. JavaScript programs will use this information to optimize their output to meet the user's display requirements. For example, a program can choose whether to use a large image or a small image depending on the size of the display, and it can choose between 16-bit color or 8-bit color based on the color depth of the display. In addition, JAVASCRIPT programs can locate new browser windows in the middle of the screen based on information about screen size


Note: There is no public standard applied to the screen object, but the object is supported by all browsers.

Ie:internet Explorer, F:firefox, O:opera.

Screen Object Properties
Attribute Description IE F O
Availheight returns the height of the display screen (other than the Windows taskbar). 4 1 9
Availwidth returns the width of the display screen (other than the Windows taskbar). 4 1 9
Bufferdepth Sets or returns the bit depth of the palette. 4 No No
ColorDepth returns the bit depth of the palette on the target device or buffer. 4 1 9
DEVICEXDPI returns the horizontal points per inch of the display screen. 6 No No
DEVICEYDPI returns the vertical dots per inch of the display screen. 6 No No
fontSmoothingEnabled returns whether the user has font smoothing enabled in the Display Control Panel. 4 No No
Height returns the height of the display screen. 4 1 9
LOGICALXDPI returns regular points that show the horizontal orientation of the screen per inch. 6 No No
LOGICALYDPI returns regular points that display the vertical direction per inch of the screen. 6 No No
Pixeldepth returns the color resolution (bits per pixel) of the display screen. No 1 9
UpdateInterval Sets or returns the refresh rate of the screen. 4 No No
Width returns the display screen widths. 4 1 9


The screens Screen object reflects the screen settings for the current user.

Width returns the size of the screen (the number of pixels).

Height returns to the screen heights.

Availwidth returns the available width of the screen (excluding the width of something similar to the taskbar that is not automatically hidden).

Availheight returns the available height of the screen.

ColorDepth returns the number of digits used for the current color setting-1: Black and white; 8:256 color; 16: Enhanced; 24/32: True Color

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.