Screen object
The javascript screen object is the window property that is used to hold information on the browser screen and to display information related to the screen. It is a property of the 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>