700
The JavaScript Screen object is used to fetch information related to the browser screen on which the current window is rendered.
It provides information about the dimensions of the display screen such as its height, width, color bits, etc.
To access the Screen object, you use the screen property of the window object like this
window.screen
Properties
Property | Description |
---|---|
availHeight | this specifies the height of screen, not including the windows taskbar |
availWidth | this specifies the width of the screen, not including the windows taskbar |
colorDepth | this specifies the depth of color palette, in bits, to display images |
height | this specifies the total height of the screen |
pixelDepth | this specifies the color resolution, in bits per pixel, of the screen |
width | this specifies the total width of the screen |
Example
<script> document.writeln("<br/>screen.width: "+screen.width); document.writeln("<br/>screen.height: "+screen.height); document.writeln("<br/>screen.availWidth: "+screen.availWidth); document.writeln("<br/>screen.availHeight: "+screen.availHeight); document.writeln("<br/>screen.colorDepth: "+screen.colorDepth); document.writeln("<br/>screen.pixelDepth: "+screen.pixelDepth); </script>
For me this displayed the following
screen.width: 2560
screen.height: 1440
screen.availWidth: 2560
screen.availHeight: 1400
screen.colorDepth: 24
screen.pixelDepth: 24