| Fasten your seat belts and get ready for
Trident—the latest breakthrough in Internet technology to hit the World
Wide Web. Trident is the codename for Microsoft's Dynamic HTML technology
that will be delivered to users with the release of Microsoft® Internet Explorer 4.0 (IE 4.0). Imagine Web
pages that dynamically sort a table of data the way a user chooses, insert
a Table of Contents with the click of a button, and allow users to drag
images and objects. All this and a whole lot more is possible with Dynamic
HTML.
In
the Beginning There was HTML…
Until now, users
had little control over the style and content of Web pages once they were
rendered. The static nature of HTML has limited the quality of user
interaction that Internet developers could provide.
HTML was originally developed as a
document format to exchange information over the Internet. It provided a
platform-independent method for describing a document in a
bandwidth-efficient manner. It was also relatively easy to interpret. As
the focus of the Web shifted primarily from the scientific and educational
communities to the commercial world, HTML was extended to provide richer
formatting capabilities. Web pages became more artistic and compelling
(largely through the creative use of images), but the underlying style and
content of the pages remained fixed.
The advent of scripting and the
ability to insert ActiveX ™
controls and applets gave Web pages their first breath of life. For the
first time, users had the ability to interact with the Web. However, this
level of interaction was a far cry from what people were used to with
traditional applications and games. Until now, client-side scripting has
been unable to directly access and change a Web page's HTML, although it
could completely overwrite it. User interactions generally required
communication with the Web server, which resulted in poor responsiveness.
HTML—The Next Generation
Microsoft has now done for HTML what it did so well (with COM) for
the world of PC software: they objectized it. By expanding the current
HTML Object Model to include HTML elements themselves, Microsoft has
exposed the content and style of Web pages to programmatic access and
control. HTML tags, style sheets, text, tables, ActiveX objects, and
applets can be dynamically modified without interaction with the Web
server. By giving client-side scripting the capability to control the
content and style of a Web page, responses to user interaction can be
handled on the client's PC, resulting in the almost instantaneous feedback
that users have come to expect from software applications.
Data manipulation,
formatting, and content changes are no longer solely dependent on Web
servers. By capitalizing on the distributed computing model, server
resources and bandwidth are conserved. The expanded object model has also
enhanced the formatting capabilities of HTML. The location of objects and
images can now be precisely specified. Overlapping and the control of an
element's z-order are also possible. The movement of images can be
achieved without the overhead of an animated GIF or other type of graphic.
There is more to
Dynamic HTML than just client-side scripting. ActiveX controls can also
access the HTML Object Model, paving the way for third-party custom
controls that perform predefined functions on the contents of a Web page
(this will be demonstrated in both this article and "Writing Internet
Explorer 4.0 Controls with Visual Basic 5.0," by Joshua Trupin, in
this issue).
Web
Browsing the Object-Oriented Way
Before diving
into the HTML Object Model, it's important to understand the role it
plays. Although Microsoft Internet Explorer appears to be a single
monolithic program, it is actually made up of a group of components. The
executable IEXPLORE.EXE is a small program that simply serves as a
container, providing a frame to Microsoft's WebBrowser object
(SHDOCVW.DLL). This object implements the basic browser features such as
forward and back navigation, favorites, page refresh, and printing.
The WebBrowser
object itself does not have the ability to display an HTML page or any
other type of document. It allows users to view and manipulate documents
by acting as an ActiveX document container, loading the ActiveX document
server that knows how to process the current URL. By taking this approach,
Microsoft has made its browser document-independent—it can be used to view
Word documents and Microsoft Excel spreadsheets as well as HTML pages.
Moreover, documents can be viewed within their own environments; not only
will Internet Explorer display a Word document, it provides the standard
Word user interface as well.

Figure 1: HTML
Viewer |
|

Figure 2:
Executing Scripts |
In
the case of Web pages, the WebBrowser object loads Microsoft's HTML Viewer
(MSHTML.DLL). This ActiveX document server provides the functionality
needed to interpret, display, and provide programmatic access to HTML
pages (see Figure 1). This entree to the HTML pages is achieved
through client-side scripting.
While the HTML Viewer knows HTML,
it doesn't know how to execute code. When a <SCRIPT> tag is detected
within a Web page, the HTML Viewer enlists the services of a scripting
engine. The appropriate engine is loaded based upon the script's language
(VBSCRIPT.DLL for Visual Basic®
Script or JSCRIPT.DLL for JScript™
and JavaScript). Once loaded, the HTML Viewer passes the code contained
within the <SCRIPT> element to the scripting engine, where it is
executed (see Figure 2).
Client-side scripting was
developed as a method of accessing the properties and methods of objects
and acting upon their events. As the host of the scripting engine, the
HTML Viewer is responsible for exposing the objects that the script
operates on. In addition to exposing a Web page's ActiveX controls, the
HTML Viewer maintains and exposes a set of objects that allow access to
elements of the browser and the content of the current Web page.
Collectively, these objects are referred to as the HTML Object Model. The
HTML Viewer exposes this object model as a set of COM interfaces. ActiveX
controls within the Web page can also access the object model through
these interfaces.
The
Dynamic HTML Object Model
The top two tiers
of the Dynamic HTML Object Model, illustrated in Figure 3, consist
of seven types of objects and one collection. The foundation of the object
model, the window object, represents the browser's window. All other
objects inherit from, and are accessed through, this one object.
|