Internet Explorer Architecture
Windows Internet Explorer's modular architecture enables developers to reuse some of its components as well as extend and enhance the browser's functionality. Examples of extensions to Internet Explorer include custom shortcut menus, browser toolbars, Microsoft ActiveX controls, active documents, and binary behaviors. This topic provides a high-level overview of Internet Explorer's architecture, information on the reuse of its components, and a summary of some of the powerful methods of extensibility available to developers. It contains the following sections.
- COM-Based Architecture
- Extending Internet Explorer
- Browser Extensions
- Content Extensions
- Hosting and Reuse
To choose the most appropriate reuse or extension mechanism for your needs, it is first important to understand Internet Explorer's architecture. Essential to the browser's architecture is the use of the Component Object Model (COM), which governs the interaction of all of its components and enables component reuse and extensibility. The following diagram illustrates Internet Explorer's major components.
A description of each of these six components follows:
IExplore.exe is at the top level, and is the Internet Explorer executable. It is a small application that relies on the other main components of Internet Explorer to do the work of rendering, navigation, protocol implementation, and so on.
Browsui.dll provides the user interface to Internet Explorer. Often referred to as the "chrome," this DLL includes the Internet Explorer address bar, status bar, menus, and so on.
Shdocvw.dll provides functionality such as navigation and history, and is commonly referred to as the WebBrowser control. This DLL exposes ActiveX Control interfaces, enabling you to easily host the DLL in a Windows application using frameworks such as Microsoft Visual Basic, Microsoft Foundation Classes (MFC), Active Template Library (ATL), or Microsoft .NET Windows Forms. When your application hosts the WebBrowser control, it obtains all the functionality of Internet Explorer except for the user interface provided by Browseui.dll. This means that you will need to provide your own implementations of toolbars and menus.
Mshtml.dll is at the heart of Internet Explorer and takes care of its HTML and Cascading Style Sheets (CSS) parsing and rendering functionality. Mshtml.dll is sometimes referred to by its code name, "Trident". Mshtml.dll exposes interfaces that enable you to host it as an active document. Other applications such as Microsoft Word, Microsoft Excel, Microsoft Visio, and many non-Microsoft applications also expose active document interfaces so they can be hosted by shdocvw.dll. For example, when a user browses from an HTML page to a Word document, mshtml.dll is swapped out for the DLL provided by Word, which then renders that document type. Mshtml.dll may be called upon to host other components depending on the HTML document's content, such as scripting engines (for example, Microsoft JScript or Microsoft Visual Basic Scripting Edition (VBScript)), ActiveX controls, XML data, and so on.
Urlmon.dll offers functionality for MIME handling and code download.
WinInet.dll is the Windows Internet Protocol handler. It implements the HTTP and File Transfer Protocol (FTP) protocols along with cache management.
Extending Internet Explorer
As Internet Explorer's component architecture is based on COM, there are many different ways to extend its capabilities. These can be broken down into three broad categories of extensions as follows:
Browser Extensions. This category of end-user extensions adds additional functionality to Internet Explorer content. It includes features such as shortcut menu extensions, custom toolbars, Explorer Bars, and Browser Helper Objects (BHOs).
Content Extensions. These extend the types of content that can be parsed and displayed; their use depends on the content being loaded into the browser. This category includes ActiveX Controls and active documents.
Hosting and Reuse. By hosting and reusing the Internet Explorer components as part of your own application, you can build your own browser or add rich rendering and Internet capabilities.
This class of extensibility adds to the UI of the browser and is not directly related to the viewable content of Web pages. It includes add-on functionality that users might install to enhance their browsing experience.
Shortcut menu extensions. It is possible to extend Internet Explorer by adding options to the shortcut menu. This is accomplished by adding registry keys that link the menu command to the task to be performed. For more information, see Controlling Shortcut Menus.
Toolbars. Custom toolbars can complement Internet Explorer's standard toolbars. An example is the MSN Toolbar. For more information, see Creating Custom Explorer Bars, Tool Bands, and Desk Bands.
Explorer Bars. Use Explorer Bars to reserve part of the browser window, either the side or the bottom of the browser window. For more information, see Creating Custom Explorer Bars, Tool Bands, and Desk Bands.
Browser Helper Objects. A Browser Helper Object (BHO) runs within Internet Explorer and offers additional services, often without any obvious user interface. For example, a BHO might highlight terms of interest to the user, such as addresses. For more information, see Browser Helper Objects: The Browser the Way You Want It.
This category of extensions is invoked specifically by Internet Explorer content. It includes ActiveX controls, binary behaviors, and active documents.
Active Documents. Active documents are sometimes called Doc Objects. If you plan to replace HTML with your own rendering of specific content, an active document may be appropriate. For example, when a user navigates from an HTML page to a Word document, the mshtml.dll active document is swapped out for Word's active document viewer. Internet Explorer's support for active documents includes the ability to merge menus so that Internet Explorer's menus reflect the functionality available in the new active document. For more information, see Active Documents.
ActiveX Controls. ActiveX controls are a very powerful mechanism for extending the abilities of HTML. For more information, see Introduction to ActiveX Controls.
Behaviors. The Behavior technology in Internet Explorer allows even deeper integration with the HTML rendering engine than ActiveX controls. There are two categories of behaviors. First are script-based behaviors using .htc files. While these are useful, they are not true extensions to browser functionality. However, you may want to consider script-based behaviors with .htc files before using a full browser extension as they provide a way to componentize and reuse HTML content.
Binary behaviors are the second category of behavior extensions. Binary behaviors are similar to ActiveX controls in that they are COM objects, but they are more deeply integrated with the HTML parser and renderer. Examples of binary behaviors include extensions for MathML and Scalable Vector Graphics (SVG), which allow the markup for math or vector graphics to be easily mixed in with HTML. For more information, see Binary Behaviors Overviews and Tutorials.
Windows Forms Controls. As managed code and the Microsoft .NET Framework have been established as the developer framework for the future, they are also available to developers wishing to develop controls for Internet Explorer. For more information, see Windows Form Controls
Pluggable Protocols. Pluggable protocols Internet Explorer to support custom communication protocols and are generally specific to the data they support. For more information, see Asynchronous Pluggable Protocols.
Hosting and Reuse
Internet Explorer's components can easily be reused thanks to its COM-based architecture. Two commonly used components are shdocvw.dll (the WebBrowser control) and mshtml.dll ("Trident").
In the majority of situations, it is better to directly host shdocvw.dll than mshtml.dll. This is because shdocvw.dll supports in-place navigation, history, and so on—that is, the full capabilities of the browser. If you host mshtml.dll directly, you gain the use of an HTML and CSS parser and renderer, but you cannot take advantage of the browser's other capabilities.
An example of a situation in which you might want to host mshtml.dll directly is the scenario of an e-mail application and HTML-based e-mail. In this scenario, the e-mail is displayed within the application, but if a user clicks on a hyperlink within the e-mail, the user would expect a separate browser instance to open rather than the e-mail application navigating in place. This is how applications such as Microsoft Outlook and Microsoft Outlook Express handle HTML-based e-mail.
For more information about hosting and reuse, see Hosting and Reuse.
The COM-based architecture of Internet Explorer supports a variety of extension mechanisms. It is important to understand the architecture and the available extension mechanisms to enure you use the one most appropriate for your application needs.