WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

JavaScript Window Screen


The window.screen object contains data about the client's screen.


Window Screen

The window.screen item can be composed without the window prefix.

Properties:

  • screen.width
  • screen.height
  • screen.availWidth
  • screen.availHeight
  • screen.colorDepth
  • screen.pixelDepth

Window Screen Width

The screen.width property restores the width of the guest's screen in pixels.

Example

Display the width of the screen in pixels:

document.getElementById("demo").innerHTML =
"Screen Width: " + screen.width;

Result will be:


Window Screen Height

The screen.height property restores the tallness of the guest's screen in pixels.

Example

Display the tallness of the screen in pixels:

document.getElementById("demo").innerHTML =
"Screen Height: " + screen.height;

Result will be:


Window Screen Available Width

The screen.availWidth property restores the width of the guest's screen, in pixels, less interface highlights like the Windows Taskbar.

Example

Display the accessible width of the screen in pixels:

document.getElementById("demo").innerHTML =
"Available Screen Width: " + screen.availWidth;

Result will be:


Window Screen Available Height

The screen.availHeight property restores the stature of the guest's screen, in pixels, short interface highlights like the Windows Taskbar.

Example

Display the accessible tallness of the screen in pixels:

document.getElementById("demo").innerHTML =
"Available Screen Height: " + screen.availHeight;

Result will be:


Window Screen Color Depth

The screen.colorDepth property restores the quantity of bits used to show one color.

All current PCs utilize 24 bit or 32 bit equipment for shading resolution:

  • 24 bits =      16,777,216 diverse "True Colors"
  • 32 bits = 4,294,967,296 diverse "Deep Colors"

Older PCs utilized 16 bits: 65,536 diverse "High Colors" resolution.

Very old PCs, and old mobile phones utilized 8 bits: 256 diverse "VGA colors".

Example

Display the shading profundity of the screen in bits:

document.getElementById("demo").innerHTML =
"Screen Color Depth: " + screen.colorDepth;

Result will be:


Window Screen Pixel Depth

The screen.pixelDepth property restores the pixel profundity of the screen.

Example

Display the pixel profundity of the screen in bits:

document.getElementById("demo").innerHTML =
"Screen Pixel Depth: " + screen.pixelDepth;

Result will be: