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?

Inversion Therapy Table

Aching back from coding all day? Try Back Problems

Stretch out your back and relieve your back muscles with inversion therapy. This device counteracts the forces of gravity on the body by decompressing and elongating the spine. By using this product just ten minutes a day, you can be well on your way to improved circulation and posture while relieving muscle aches, back pain and stress.

$$ Check price
119.98119.98Amazon 4.5 logo(1,700+ reviews)

More Back Problems resources

Build modern and responsive webpages

The Modern Web

Build modern and responsive webpages Try Front-end

The Modern Web will guide you through the most important tools of device-agnostic web development, including HTML5, CSS3, and JavaScript. The plain-english explanations and practical examples emphasize the techniques, principles, and practices that you'll need to easily transcend individual browser quirks and stay relevant as these technologies are updated.

$ Check price
34.9534.95Amazon 4.5 logo(30+ reviews)

More Front-end resources

Ad