Introducing the Browser Object Model
from Instant IE4 Dynamic HTML Programmer's Reference
By Alex Homer & Chris Ullman
It was supposed to be a standard. But HTML, the lingua franca of the Web, didn't outlast event the first commercial browser. Netscape Navigator 1.0 introduced a raft of formatting tags not in the formal HTML specification, from <CENTER> to <> -- and much to the chagrin of standards organizations, people loved them. Since then, every brower upgrade has brought with it a laundry list of new improved tags.
Dynamic HTML is an amalgam of efforts by Netscape, Microsoft and the W3C to enable Web authors to produce pages that are universally readable, but also highly functional and visually stunning. This article focuses on the extended browser object model that gives DHTML much of its power.
Since the advent of Netscape 2, the first browser to provide a documented object model, it has been possible to use the scripting code in a page to access both the browser environment, and the contents of the page itself. This access was severely limited when it came to the things other than controls in the page (such as text or graphics). While you could access such things as HTML text boxes and list boxes, and Java applets or ActiveX controls, you couldn't get at the real contents of the document. The text, images, headings, and other page contents remained temptingly out of reach.
Today, Drop Caps. Tomorrow, The World
This all changes in Dynamic HTML. Almost anything that's visible in the page, plus many things that aren't, can be accessed through the extensions to the object model. This is the subject of this chapter. We'll take an overview of the whole structure, then investigate the new and the most useful objects. In the next chapter, we'll continue this process, and look at the objects that are most useful for integrating our script into a web page.
In this full-length chapter excerpt, we'll cover:
- The browser object model in outline, and compare it to older browsers
- A brief tour of the basic window objects, generally unchanged from earlier versions
- A look at some of the more useful new objects and collections
Enough preamble. Let's get to it!