BOM

The BOM (Browser Object Model) is a collection of objects that give you access to the browser and the computer screen. These objects are accessible through the global objects window and window.screen.

The window Object Revisited

As you know already, in JavaScript there's a global object provided by every host environment. In the browser environment, this is the window object. All global variables become properties of the window object.

>>> window.somevar = 1;

1

>>> somevar

1

Also, all of the core JavaScript functions (discussed in Chapter 2) are methods of the window object.

>>> parseInt('123a456')

123

>>> window.parseInt('123a456')

123

In addition to being the global object, the window object also serves a second purpose and that is to ...

Get Object-Oriented JavaScript 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.