What Is Window Object?

The Object Model in Overview

The browser object model can be thought of as physically part of the software that forms the browser, while Dynamic HTML is (in theory at least) a universal browser-independent document definition language.

This means that all browsers which host Dynamic HTML must provide the same object model. Otherwise, it would be impossible to create pages that performed properly on different browsers.

However, the object model is, in fact, simply an interface between the Dynamic HTML source code in the page, and the browser software routines that create the window and fill it with the elements defined in the page. How it does this filling of the window, or rendering of the page, is unimportant. Dynamic HTML simply defines what the results should be, not how the processes should be implemented.

The Window Object

In previous DHTML articles we concentrated on the Document Object Model. The DOM represents the document displayed in a browser. But there are also circumstances in which we need to access information about the browser itself.

The root element of the BOM is the window object. As the DOM is part of the BOM, technically we should reference objects by: window.document.myElement.value; but this level of description is rarely necessary.

It is important however to be able to visualize the window as an object – and as an object it contains other child objects, as well as methods. The BOM contains one instance of a window object. This represents the instance of the browser. Further browsers have their own separate and distinct window objects.

The window object can contain frames, which in turn may contain window objects. This hierarchical system can continue indefinitely, although practical considerations do eventually interfere.

The window object has several properties, but most are too complex for this article. We will meet parent and top when we look at frames, but let’s start with status and defaultStatus.