This is the window.screen
object.
<script>// <![CDATA[ document.writeln(screen + "<br />"); for (x in screen) { document.writeln("<b>" + x + " :</b> " + screen[x] + "<br />"); } // ]]></script>
[object Screen]
The screen
object contains information about the user’s screen.
screen
object, but all major browsers support it.
June 15, 2016: The screen
object is currently being defined in the “CSSOM View Module” editor’s draft.
Properties
screen.availHeight
Property | Type | Value |
---|---|---|
availHeight | long |
Read only. The availHeight
attribute must return the available height of the rendering surface of the output device, in CSS pixels.
Returns the height of the screen (excluding the Windows Taskbar).
screen.availLeft
Property | Type | Value |
---|---|---|
availLeft |
screen.availTop
Property | Type | Value |
---|---|---|
availTop |
screen.availWidth
Property | Type | Value |
---|---|---|
availWidth | long |
Read only. The availWidth
attribute must return the available width of the rendering surface of the output device, in CSS pixels.
Returns the width of the screen (excluding the Windows Taskbar).
screen.colorDepth
Property | Type | Value |
---|---|---|
colorDepth | unsigned long |
Read only. The colorDepth
attribute must return 24. The colorDepth
attribute is useless but is included for compatibility.
Returns the bit depth of the color palette for displaying images.
screen.height
Property | Type | Value |
---|---|---|
height | long |
Read only. The height
attribute must return the height of the output device, in CSS pixels.
Returns the total height of the screen.
screen.left
Property | Type | Value |
---|---|---|
left |
screen.mozOrientation
Property | Type | Value |
---|---|---|
mozOrientation |
screen.pixelDepth
Property | Type | Value |
---|---|---|
pixelDepth | unsigned long |
Read only. The pixelDepth
attribute must return 24. The pixelDepth
attribute is useless but is included for compatibility.
Returns the color resolution (in bits per pixel) of the screen.
screen.top
Property | Type | Value |
---|---|---|
top |
screen.width
Property | Type | Value |
---|---|---|
width | long |
Read only. The width
attribute must return the width of the output device, in CSS pixels.
Returns the total width of the screen.
Methods
screen.addEventListener()
addEventListener: function addEventListener() { [native code] }
screen.dispatchEvent()
dispatchEvent: function dispatchEvent() { [native code] }
screen.mozLockOrientation()
mozLockOrientation: function mozLockOrientation() { [native code] }
screen.mozUnlockOrientation()
mozUnlockOrientation: function mozUnlockOrientation() { [native code] }
screen.removeEventListener()
removeEventListener: function removeEventListener() { [native code] }
Events
screen.onmozorientationchange
onmozorientationchange: null
Objects
orientation: [object ScreenOrientation]
screen.orientation
<script>// <![CDATA[ document.writeln(screen.orientation + "<br />"); for (x in screen.orientation) { document.writeln("<b>" + x + " :</b> " + screen.orientation[x] + "<br />"); } // ]]></script>
References
Mozilla Contributors. “Screen”. Mozilla Developer Network. July 29, 2015.
Pieters, Simon, ed. “CSSOM View Module”. Editor’s Draft. World Wide Web Consortium (W3C). June 15, 2016.