Fly with code

Get wet inside ocean of code

0%

Introduce Concept of BOM - Browser Object Model

What is BOM ?

  • According to w3C, The Browser Object Model (BOM) allows JavaScript to "talk to" the browser.
  • There are no official standards for the Browser Object Model (BOM).
  • The window object is supported by all browsers. It represents the browser’s window.
  • All global JavaScript objects, functions, and variables automatically become members of the window object.
  • Even the document object (of the HTML DOM) is a property of the window object.

window

  • Allow user to manipulate and access browser screen.

screen

  • The window.screen object contains information about the user’s screen.

Location

  • The window.location object can be used to get the current page address (URL) and to redirect the browser to a new page.

History

  • The window.history object contains the browsers history.

Navigator

  • The window.navigator object contains information about the visitor’s browser.

Popup

  • An alert box is often used if you want to make sure information comes through to the user.

Timing

  • The window object allows execution of code at specified time intervals.

Cookies

  • Cookies let you store user information in web pages.

Some common used BOM functions

  • window.print()
  • location.href()
  • window.open()