JS: Browser Window Object

By Xah Lee. Date: . Last updated: .

There are 3 kinds of objects you work with when using JavaScript for website:

Browser's Window Object (Browser Object Model. BOM)

The browser's window object is the root global object.

Everything is a property of the window object, including:

Google Chrome console window object 2014
Google Chrome console showing the window object

In browser console, type window to view this object's properties. [see How to Use Browser Console]

The window object has important properties. For example:

You don't need to prefix window. to use its methods or properties. For example, alert("3") is same as window.alert("3")

The window object also has a property key "window", so window.window and window.window.window are the same as just window.

The window object and its properties and their behavior is called Browser Object Model (BOM).

Browser's Document Object (Document Object Model. DOM)

One of the most important property of window is window.document. This is the document object.

The document object represent the HTML/XML document in the browser window.

The document object contains methods to manipulate HTML elements and styles. This object system is called DOM (Document Object Model).

The DOM allows you to:

[see DOM: Basic DOM Methods]

Buy JavaScript in Depth

JavaScript in Depth

JS Obj Ref




Basic Examples

HTML Input

Web Scripting Examples

Web Scripting Misc