WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

JavaScript Window Screen



The window.screen object contains information about the user's screen.


Window Screen

window.screen Objects can be written without the window prefix.

Some attributes:

  • screen.availWidth-available screen width
  • screen.availHeight-available screen heights


Available width of Window Screen

The

screen.availWidth property returns the width of the visitor's screen, in pixels, minus interface characteristics, such as the window taskbar.

Example

Return to the available width of your screen:

<script>
document.write("Available width: " + screen.availWidth);
</script>

The output of the above code is:

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:


Available height of Window Screen

screen.availHeight property returns the height of the visitor's screen, in pixels, minus interface features, such as the window taskbar.

Example

Return the available height of your screen:

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: