Support for Smart Tags in Internet Explorer [Office 2003 SDK Documentation]

Microsoft® Office XP and the Microsoft Office 2003 Editions install a helper behavior that enables smart tag support in Microsoft Internet Explorer. (Internet Explorer does not support smart tags natively.)

In the Office 2003 Editions, TAB-key support is added to Internet Explorer. TAB-key support for smart tags allows a user to cycle through smart tags in Internet Explorer by using the TAB key. The smart tag action menu for a given smart tag can be displayed by pressing the ALT+SHIFT+F10 key combination, or by using the SPACEBAR or ENTER key.

Smart tags in Internet Explorer operate a little differently from smart tags in Microsoft Office applications. Smart tags displayed on Web pages will persist even if the DLLs corresponding to these smart tags are not installed on the client. For example, if an e-mail message in HTML format with a smart tag is sent by using Microsoft Office Outlook® to someone who does not have that particular smart tag DLL installed, the recipient of the Outlook message will still see the pertinent items labeled as smart tags. These smart tags, moreover, will be fully functional if the recipient of the message has actions for that particular smart tag type installed.

Element Declaration

Text is not recognized by smart tags automatically in Internet Explorer 5.0, 5.5 and 6.0. However, specific custom HTML tags can be added to the HTML source file to enable recognition of text for which you want to have smart tags. The following sections explain the five main element tags a developer needs to include in Web pages in order to use smart tags within the browser.

Namespace element declaration

Each smart tag can have its own namespace. Smart tag namespaces are declared at the top of the HTML document.

In HTML, it is written this way:

<html xmlns:example="urn:schemas-fourth-com:contact" . . . >

Therefore, any tag starting with "example:" in the body of the HTML source file is in the contact namespace. For example, in <example:customer>Frank Miller</example:customer>, "Frank Miller" is in the contact namespace and "example" is a shorthand alias for the entire namespace.

Smart tags that share the same local name but exist in different namespaces are also supported. For example, "urn:schema-fourth-com:contact" and "urn:schema-fourth2-com:contact" are two different smart tag namespaces even though they have an identical local name ("contact"). They exist in different namespaces, and therefore are distinct and valid.

SmartTagType element declaration

To enhance the deployment of smart tags across machines, developers are provided with a mechanism for embedding download URLs in their documents.

Smart tag download URLs are stored as XML at the top of an HTML document. At the top of an HTML file, Microsoft Office embeds a list of smart tag namespaceURI/tagname combinations for the smart tag types that have been used in the document. This is done so that Office applications on other computers will recognize certain arbitrary namespaceURIs and tags as smart tags even if these computers do not have the corresponding smart tag recognizers installed. It also enables the creation of download URLs for different smart tag types that have been specified.

Here is an example of one smart tag type declaration:

<o:SmartTagType 
name="customer" 
namespaceuri="urn:schemas-fourth-coffee:contact" 
downloadurl="http://www.fourthcoffee.com/download.asp">
</o:SmartTagType>

The SmartTagType element belongs to the Office namespace.

There are three attributes of this element:

  • name  The name of the smart tag type. This attribute is required.
  • namespaceuri  The namespace URI for the smart tag type. This attribute is required.
  • downloadurl  A URL useful for downloading a smart tag package. This attribute is optional.

The o:SmartTagType element is declared in the <HEAD> tag of an HTML document.

Object element declaration

The following Object element must be added to the HTML page to enable the rendering of the Smart Tag Actions button in Internet Explorer:

<OBJECT 
classid ="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui>
</OBJECT>

The classid attribute sets the class identifier for the object.

Behavior element declaration

In Microsoft® Internet Explorer 5.0 and above, Dynamic HTML (DHTML) behaviors are simple, lightweight components that encapsulate specific functionality or behavior on a page. When applied to a standard HTML element on a page, a behavior enhances that element's default behavior.

Microsoft Office XP and the Microsoft Office 2003 Editions provide a behavior DLL that implements Internet Explorer's IBehavior* interfaces. The Behavior element provides a means for Web developers to extend the current Internet Explorer object model. It allows DHTML behaviors to be bound synchronously to a custom element, ensuring that the functionality of the behavior is never removed from the element. When using a custom element, a namespace must be declared.

In the browser, the behavior DLL is attached as a behavior handler for all elements that have namespaces associated with smart tags. In order to do this, the following element must be embedded:

<STYLE> 
     example\:*{behavior:url(#ieooui)} 
</STYLE>

In this case, the behavior DLL is mapped to a namespace called "example". The Behavior interface in Internet Explorer is able to detect when actions are being explicitly activated from either Internet Explorer or Microsoft Office Outlook® on the client.

Mapping smart tag namespaces to behavior DLLs

In HTML documents, smart tag namespaces are linked to a given behavior DLL that enables smart tag actions in Internet Explorer. In the following example, "test" is an alias for a smart tag type's namespace and is associated with specific smart tag behavior:

<STYLE>
    test\:*{behavior:url(#ieooui)}  
</STYLE>