Packagecssom.view
Interfacepublic interface Screen

Introduced in: DOM 0 

Has properties that hold information about the screen.

All browser compatibility information was obtained via Quirksmode.

See also

W3C CSSOM Views Specification: Screen
Quirksmode: W3C DOM Compatibility - CSS Object Model View


Public Properties
 PropertyDefined By
  CSSOM View availHeight : Number
[read-only] Returns the amount of vertical space available to the window on the screen.
Screen
  CSSOM View availWidth : Number
[read-only] Returns the amount of horizontal space in pixels available to the window.
Screen
  CSSOM View colorDepth : Number
[read-only] Returns the lowest number of bits from the color components of the output device.
Screen
  CSSOM View height : Number
[read-only] Returns the height of the screen in pixels.
Screen
  CSSOM View pixelDepth : Number
[read-only] Returns the lowest number of bits from the color components of the output device.
Screen
  CSSOM View width : Number
[read-only] Returns the width of the screen.
Screen
Property Detail
CSSOM View availHeightproperty
availHeight:Number  [read-only]

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in: DOM 0 

Returns the amount of vertical space available to the window on the screen.


Implementation
    public function get availHeight():Number

See also


Example
         if (window.screen.availHeight != window.screen.height) {
             // something's in the way!
             // use available to size window
         }
CSSOM View availWidthproperty 
availWidth:Number  [read-only]

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in: DOM 0 

Returns the amount of horizontal space in pixels available to the window.


Implementation
    public function get availWidth():Number

See also


Example
         if (window.screen.availHeight != window.screen.height) {
             // something's in the way!
             // use available to size window
         }
CSSOM View colorDepthproperty 
colorDepth:Number  [read-only]

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in: DOM 0 

Returns the lowest number of bits from the color components of the output device.


Implementation
    public function get colorDepth():Number

See also


Example
Check the color depth of the screen
         if ( window.screen.colorDepth < 8) {
             // use low-color version of page
         } else { 
             // use regular, colorful page
         }
CSSOM View heightproperty 
height:Number  [read-only]

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in: DOM 0 

Returns the height of the screen in pixels.


Implementation
    public function get height():Number

See also


Example
         if (window.screen.availHeight != window.screen.height) {
             // something is occupying some screen real estate!
         }
CSSOM View pixelDepthproperty 
pixelDepth:Number  [read-only]

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in: DOM 0 

Returns the lowest number of bits from the color components of the output device.


Implementation
    public function get pixelDepth():Number

See also


Example
         // if there is not adequate bit depth choose a simpler color
         if ( window.screen.pixelDepth > 8 ) {
             document.style.color = "#FAEBD7";
         } else {
             document.style.color = "#FFFFFF";
         }
CSSOM View widthproperty 
width:Number  [read-only]

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in: DOM 0 

Returns the width of the screen.


Implementation
    public function get width():Number

See also


Example
Crude way to check that the screen is at 1024x768
         if (window.screen.width > 1000) {
             // resolution is below 10 x 7
         }