Built-in Objects and Their Properties

Several important built-in objects have properties that you need to understand for optimal use with JavaScript. This section examines two key objects: the screen and the window. The window properties examined here are specific to the window object and do not refer to virtually every other object that is a property of the window object.

Reading Screen Properties

When a browser opens an HTML page, it does so with the screen properties determined by the viewer’s equipment. All screen properties are read-only and are static as far as the designer/developer is concerned. The screen object has five cross-browser properties:

							screen.availHeight 
screen.availWidth 
screen.colorDepth 
screen.height 
screen.width 

Get JavaScript Design now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.