01. The Browser Object Model

JavaScript's power and flexibility comes from its ability to access and manipulate objects that are native to the browser environment.

The collection of these objects is known as the Browser Object Model (BOM). The BOM is a tree-like hierarchy of objects, each with useful access properties and methods. Essentially, this object allows you to talk with your user's browser.

Functions include querying the the browser window size, the main heading of the page, a pointer to the last page in a user's history and more!

Elements of the Browser Object Model

The BOM's root is the window object, which displays properties of the current open window or tab. It has several children, most of which we'll cover in this section.

JavaScript BOM tree

Here is a brief description of each element on the tree.

document
Contains all HTML elements of the current page.
frames
Any frames embedded within the current page.
history
Contains a stack of sites visited in the current session.
location
Stores URL of the current page.
navigator
Stores information about the browser being used, and the OS used by the browser.
screen
Display properties of the user's computer or device.

Because the document element has much to cover, it deserves its own section; we'll cover the other elements here, starting with the window object.

Aching back from coding all day?

Prism Glasses

Aching back from coding all day? Try Back Problems

Ever feel achy from sitting crunched up on your computer table? Try lying down with these optical glasses that allow you to work on your laptop while lying flat on your back. This is the perfect solution with those with limited mobility or those who wish to prevent neck cramps and back strains.

$ Check price
4.454.45Amazon 4 logo(128+ reviews)

More Back Problems resources

Build modern and responsive webpages

JavaScript & JQuery

Build modern and responsive webpages Try Front-end

This book was written for anyone who wants to use JavaScript to make their websites a little more interesting, engaging, interactive, or usable. In particular, it is aimed at people who do not have a degree in computer science (well, not yet anyway).

$ Check price
39.9939.99Amazon 4.5 logo(385+ reviews)

More Front-end resources

Ad