Skip to main content
IElementBehaviorFactory interface

Provides a standard mechanism for MSHTML to locate and instantiate a Dynamic HTML (DHTML) behavior.


The IElementBehaviorFactory interface inherits from the IUnknown interface but does not have additional members.


MSHTML attempts to locate and instantiate a DHTML behavior when it finds a reference to the behavior during the parsing of an HTML document.

MSHTML initially calls the host application's IServiceProvider::QueryService and specifies the SID_SElementBehaviorFactory identifier, to request the IElementBehaviorFactory interface. The hosting application provides this service through its client site.

If the IElementBehaviorFactory interface is available, MSHTML calls the IElementBehaviorFactory::FindBehavior method to instantiate the DHTML behavior. If successful, this method returns an IElementBehavior interface.

If the DHTML behavior is not available, MSHTML queries the object elements on the page to see if they implement the DHTML behavior. Position the object element serving the behavior factory before any IMPORT statements, so that when custom elements are read into the namespace, Windows Internet Explorer can find the IElementNamespaceFactory.

The component object that implements the IElementBehaviorFactory interface does not have to be safe for scripting or persistence. If an object is not safe, then Internet Explorer prompts with a warning dialog box, which provides a choice between downloading and instantiating the behavior, and canceling the operation.

Use the IObjectSafety interface to identify a DHTML behavior component object as safe for scripting. See Supporting the IObjectSafety Interface, and Signing Code with Microsoft Authenticode Technology, which provides information on how to sign component objects and mark them as safe.


Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server