Window.screen

  • Revision slug: DOM/window.screen
  • Revision title: window.screen
  • Revision id: 130944
  • Created:
  • Creator: Mgjbot
  • Is current revision? No
  • Comment robot Adding: [[ja:DOM:window.screen]] <<langbot>>

Revision Content

{{ DomRef() }}

Summary

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

Syntax

screenObj = window.screen

Example

if (screen.pixelDepth < 8) {
  // use low-color version of page
} else { 
  // use regular, colorful page
}

Notes

The screen object is a special object for inspecting properties of the screen on which the current window is being rendered.

This object has the following properties:

availTop
Specifies the y-coordinate of the first pixel that is not allocated to permanent or semipermanent user interface features.
availLeft
Returns the first available pixel available from the left side of the screen.
availHeight
Specifies the height of the screen, in pixels, minus permanent or semipermanent user interface features displayed by the operating system, such as the Taskbar on Windows.
availWidth
Returns the amount of horizontal space in pixels available to the window.
colorDepth
Returns the color depth of the screen.
height
Returns the height of the screen in pixels.
left
Returns the distance in pixels from the left side of the main screen to the left side of the current screen.
pixelDepth
Gets the bit depth of the screen.
top
Returns the distance in pixels from the top side of the current screen.
width
Returns the width of the screen.

Specification

{{ DOM0() }}

{{ languages( { "ja": "ja/DOM/window.screen", "pl": "pl/DOM/window.screen" } ) }}

Revision Source

<p>
{{ DomRef() }}
</p>
<h3 name="Summary"> Summary </h3>
<p>Returns a reference to the screen object associated with the window.
</p>
<h3 name="Syntax"> Syntax </h3>
<pre class="eval"><i>screenObj</i> = <i>window</i>.screen
</pre>
<h3 name="Example"> Example </h3>
<pre class="eval">if (screen.pixelDepth &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 object for inspecting properties of the screen on which the current window is being rendered.
</p><p>This object has the following properties:
</p>
<dl><dt> <a href="en/DOM/window.screen.availTop">availTop</a>
</dt><dd> Specifies the y-coordinate of the first pixel that is not allocated to permanent or semipermanent user interface features.
</dd></dl>
<dl><dt> <a href="en/DOM/window.screen.availLeft">availLeft</a>
</dt><dd> Returns the first available pixel available from the left side of the screen.
</dd></dl>
<dl><dt> <a href="en/DOM/window.screen.availHeight">availHeight</a>
</dt><dd> Specifies the height of the screen, in pixels, minus permanent or semipermanent user interface features displayed by the operating system, such as the Taskbar on Windows.
</dd></dl>
<dl><dt> <a href="en/DOM/window.screen.availWidth">availWidth</a>
</dt><dd> Returns the amount of horizontal space in pixels available to the window.
</dd></dl>
<dl><dt> <a href="en/DOM/window.screen.colorDepth">colorDepth</a>
</dt><dd> Returns the color depth of the screen.
</dd></dl>
<dl><dt> <a href="en/DOM/window.screen.height">height</a>
</dt><dd> Returns the height of the screen in pixels.
</dd></dl>
<dl><dt> <a href="en/DOM/window.screen.left">left</a>
</dt><dd> Returns the distance in pixels from the left side of the main screen to the left side of the current screen.
</dd></dl>
<dl><dt> <a href="en/DOM/window.screen.pixelDepth">pixelDepth</a>
</dt><dd> Gets the bit depth of the screen.
</dd></dl>
<dl><dt> <a href="en/DOM/window.screen.top">top</a>
</dt><dd> Returns the distance in pixels from the top side of the current screen.
</dd></dl>
<dl><dt> <a href="en/DOM/window.screen.width">width</a>
</dt><dd> Returns the width of the screen.
</dd></dl>
<h3 name="Specification"> Specification </h3>
<p>{{ DOM0() }}
</p>
<div class="noinclude">
</div>
{{ languages( { "ja": "ja/DOM/window.screen", "pl": "pl/DOM/window.screen" } ) }}
Revert to this revision