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
COM-Based
Architecture
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 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.
Browser
Extensions
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 performedToolbars. Custom toolbars can complement Internet Explorer's standard toolbars. An example is the MSN Toolbar.
- Explorer Bars. Use Explorer Bars to reserve part of the browser window, either the side or the bottom of the browser window
- 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.
Content
Extensions
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.
- ActiveX Controls. ActiveX controls are a very powerful mechanism for extending the abilities of HTML.
- 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.
- Windows Forms Controls. As managed code and the .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.
- Pluggable Protocols. Pluggable protocols Internet Explorer to support custom communication protocols and are generally specific to the data they support..
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 Outlook Express handle HTML-based e-mail.
IE is not just a web browser. it's a broad platform that provides Windows with the components necessary to integrate web services with desktop applications. Its complex architecture and extensibility points reflect this, as well as the number of applications that attach into it.
ReplyDelete