Window.screen

  • Revision slug: DOM/window.screen
  • Revision title: window.screen
  • Revision id: 130938
  • Created:
  • Creator: Gor1
  • Is current revision? No
  • Comment

Revision Content

{{template.DomRef()}}

Summary

Returns a reference to the screen object associated with the window.

Syntax

screenObj = window.screen

Example

s = window.screen;
if ( s.colorDepth < 8) {
    // use low-color version of page
} else { 
    // use regular, colorful page
}

Notes

The screen object is a special JavaScript object for controlling aspects of the screen on which the current window is being rendered. screen object properties such as colorDepth, height, and availHeight can be accessed from the window object by using properties like window.screen.colorDepth and others described below.

Specification

DOM Level 0. Not part of specification.

Revision Source

<p>
{{template.DomRef()}}
</p>
<h3 name="Summary"> Summary </h3>
<p>Returns a reference to the <code>screen</code> object associated with the window.
</p>
<h3 name="Syntax"> Syntax </h3>
<pre class="eval">screenObj = window.screen
</pre>
<h3 name="Example"> Example </h3>
<pre class="eval">s = window.screen;
if ( s.colorDepth &lt; 8) {
    // use low-color version of page
} else { 
    // use regular, colorful page
}
</pre>
<h3 name="Notes"> Notes </h3>
<p>The <code>screen</code> object is a special JavaScript object for controlling aspects of the screen on which the current window is being rendered. <code>screen</code> object properties such as <code>colorDepth</code>, <code>height</code>, and <code>availHeight</code> can be accessed from the <code>window</code> object by using properties like <code>window.screen.colorDepth</code> and others described below.
</p>
<h3 name="Specification"> Specification </h3>
<p>DOM Level 0. Not part of specification.
</p>
Revert to this revision