JavaScript – Browser Object Model


What is BOM in Javascript ?

BOM is Browser Object Model.

Browser Object Model provides the properties and methods for JavaScript to interact with the web browser.

Browser Object Model will refer all the objects exposed by the web browser.

Browser Object Mode allows javascript to interact with the browser.

How to access the BOM window object ?

Window object can be executed with or without ‘window’ prefix.

Javascript complete tutorial !!!

Click to Learn More about – Javascript online learning

Syntax :

window.screen

Or

screen

What are the objects BOM refers for browser ?

BOM objects include

1. Navigator object.

2. Location object.

3. Window object.

4. Screen object.


5. Document object.

6. History object.

All the objects governs the browser corresponding features.

The Browser objects are created automatically by the browser.

1. Navigator Object

This finds the browser information like ( appCodeName, userAgent, appName, appVersion, etc).

This creates the JavaScript based upon the browser used by the user, which has been enabled by the user for that browser.

2. Location Object

This finds information about the current URL opened on the web browser.

This also controls the current web page displayed in the web browser.

This have properties like (host, origin, port, pathname, search, etc).

3. Window Object

This is the top most object present in the BOM.

This represents current window opened in the browser at this time.

This contains all the other objects in it.

This have methods and properties, which helps even to control the web browser.

4. Screen Object

This provides the information about the browser screen such as the height, width, pixelDepth, colorDepth, etc.


This contains properties like availWidth, availHeight, colorDepth, pixelDepth.

5. Document Object

The web pages shown in the web browser are represented by the Document Object.

This contains all the tags & elements present on the web page including the HTML elements.

This is the most important part of the Browser Object Model.

6. History Object

This provides all information related to the browser’s history.

This provides a list of all the URL of the websites visited by the user. This is useful for loading any previous page as well as any particular page.

This have three methods

SnoMethod / FunctionDescription
1forward()For loading the browser forward url in the browser.
2go()For loading the current url in the browser.
3back()For loading the previous url in the browser.