The window.screen object contains information about the user's screen.
The window.screen object can be written without the window prefix.
Properties:
The screen.width property returns the width of the visitor's screen in pixels.
Display the width of the screen in pixels:
Result will be:
The screen.height property returns the height of the visitor's screen in pixels.
Display the height of the screen in pixels:
Result will be:
The screen.availWidth property returns the width of the visitor's screen, in pixels, minus interface features like the Windows Taskbar.
Display the available width of the screen in pixels:
Result will be:
The screen.availHeight property returns the height of the visitor's screen, in pixels, minus interface features like the Windows Taskbar.
Display the available height of the screen in pixels:
Result will be:
The screen.colorDepth property returns the number of bits used to display one color.
All modern computers use 24 or 32 bits hardware to display 16,777,216 different colors ("True Colors").
Older computers used 16 bits, which gives a maximum of 65,536 different colors ("High Colors")
Very old computers, and old cell phones used 8 bits ("VGA colors").
Display the color depth of the screen in bits:
Result will be:
![]() |
Some computers report 32. Most computers report 24. Both display "True Colors" (16,777,216 different colors). |
---|
The screen.pixelDepth property returns the pixel depth of the screen.
Display the pixel depth of the screen in bits:
Result will be:
![]() |
For modern computers, Color Depth and Pixel Depth are equal. |
---|