javascript Screen object

Screen object

The javascript screen object is the window property which is used to hold information of browser screen and to display informations related to screen. It is a property of window object and thus can be written as window.screen or only screen.

Properties of Screen Object:

PROPERTY USES
screen.availWidth To get the available width of the screen.
screen.availHeight To get the available height of the screen.
screen.colorDepth To get the color depth of the screen.
screen.height To get the height of the screen.
screen.pixelDepth To get the pixel depth of the screen.
screen.width To get the width of the screen.

 

Example:

<!DOCTYPE html>
<html>
<body>
 
<p id="navigator1"></p>
<p id="navigator2"></p>
<p id="navigator3"></p>
<p id="navigator4"></p>
<p id="navigator5"></p>
<p id="navigator6"></p>
 
<script>
document.getElementById("navigator1").innerHTML =
"Screen Width: " + screen.width;
document.getElementById("navigator2").innerHTML = "Screen Height: " + screen.height;
document.getElementById("navigator3").innerHTML =
"Available Screen Width: " + screen.availWidth;
document.getElementById("navigator4").innerHTML =
"Available Screen Height: " + screen.availHeight;
document.getElementById("navigator5").innerHTML = "Screen Color Depth: " + screen.colorDepth;
document.getElementById("navigator6").innerHTML =
"Screen Pixel Depth: " + screen.pixelDepth;
</script>
 
</body>
</html>

Output:

Screen Width: 1366
Screen Height: 768
Available Screen Width: 1366
Available Screen Height: 732
Screen Color Depth: 24
Screen Pixel Depth: 24
Please Share