Google News
logo
Javascript Screen Object
The screen object in JavaScript represents the current display screen in your browser. The window.screen object can be written without the window prefix.
Screen object Properties :
Property Description
screen.width specifies the total width of the screen
screen.height specifies the total height of the screen
screen.availWidth specifies the width of the screen, excluding the Windows Taskbar
screen.availHeight specifies the height of the screen, excluding the Windows Taskbar
screen.colorDepth specifies the depth of the color palette, in bits, to display images
screen.pixelDepth specifies the color resolution, in bits per pixel, of the screen
Example Program :
<html>
<head>
<title>JavaScript Screen Object</title>
</head>
<body>
 
<h3>JavaScript Screen Object Example</h3>
 
<script type="text/javascript">
 
document.writeln("<strong>Total Height = </strong>" + screen.height + "<br/>");
document.writeln("<strong>Total Weight = </strong>" + screen.width + "<br/>");
document.writeln("<strong>Available Width = </strong>" + screen.availWidth + "<br/>");
document.writeln("<strong>Available Height = </strong>" + screen.availHeight + "<br/>");
document.writeln("<strong>Screen Color Depth = </strong>" + screen.colorDepth + "<br/>");
document.writeln("<strong>Screen Pixel Depth = </strong>" + screen.pixelDepth + "<br/>");
 
</script>
 
</body>
</html>
Output :

JavaScript Screen Object Example