.gif)
Note: This documentation is preliminary and is subject to change.
Internet Explorer 7 promoted search to the top level with the Instant Search box. The Instant Search box provides an AutoComplete feature so users can search for similar search terms used in previous searches. Internet Explorer 7 enables users to add multiple search providers.
Search improvements in Internet Explorer 8 focus on helping users search by significantly improving the Instant Search box drop-down menu and supporting search suggestions.
This topic addresses two audiences: end users and Web site developers. The first part of this topic focuses on helping end users install search providers, manage search providers, and use a favorite search provider to find what they want. The second part of this topic focuses on Web site developers by showing how to promote a search provider and how to use search suggestions to improve a user's experience with your search provider.
This topic discusses the following subjects:
End User Search Features
The Instant Search feature in Internet Explorer 8 enables the end user to add favorite search providers and quickly switch between providers during a search. Internet Explorer 8 supports search suggestions to help users initiate better search queries. Search providers can also provide instant answers to queries. In addition to using the Instant Search box, users can access all of their search providers through the Accelerators menu. These features are designed to improve search experience and increase productivity for end users.
This section covers the following topics:
Adding Search Providers
The Instant Search box in the upper-right corner of the Internet Explorer 8 browser window replaces the Windows Search Assistant (or Search Pane). Before you can use a specific search provider, you must add that provider to your list. To add a search provider, browse to the provider's Web site. There are two ways to install a search provider.
First, the provider Web site might display a link or button that you can click to add the search provider to your list. By clicking the link or button, the Add Search Provider dialog box is displayed so you can confirm your selection.
.gif)
Figure 1. Add Search Provider dialog box.
If this particular search provider is already installed, you will get a dialog box saying so or you will get a dialog box with options to upgrade that provider. For example, the search provider may offer search suggestions now where it did not before.
The second way to add a search provider is by discovery. After the providers Web page loads, the drop-down arrow on the Instant Search box turns orange, indicating that a search provider can be installed.
.gif)
Figure 2. Orange drop-down arrow on the Instant Search box.
When you click the orange drop-down arrow, a list of the search providers that are installed and other available options is displayed. A gold ball appears next to the search providers that Internet Explorer 8 discovered. When you click the Add Search Providers option, a list of the available providers is displayed. The following picture shows the Live Search options: Products, Images, and Videos.
.gif)
Figure 3. Add Search Provider menu showing search providers and search options.
Adding Your Own Search Provider
If your search provider does not provide a way for you to add it as a search provider, you can still add it. Follow the instructions on the Windows Search Guide page to create your own search provider. Note that this widget adds the provider only as a search provider without search suggestions. If you know that the provider offers search suggestions, use the search provider's Web site to add the provider.
Managing Search Providers
The maximum number of search providers you can install is 200, which might be challenging to manage.To manage your search providers in Internet Explorer 8, click the drop-down arrow on the Instant Search box, and then click Manage Search Providers. You can reorder providers, change the default Status, and remove a provider, as shown in the following picture.
.jpg)
Figure 4. Manage Internet Explorer Add-ons dialog box.
To change a search provider's attributes, click the provider name, make your changes, and click the Close button.
Note You cannot remove the current Default provider. To remove the default provider, you must set another provider to Default status. Open the Manage Search Providers dialog box, click another provider, and then click the Set as default button. Click the provider you want to remove and click the Remove button.
Searching With My Favorite Search Providers
To perform a search, type the search term in the Instant Search box. While you might be familiar with this box in Internet Explorer 7, you will notice significant improvements in how you can search in Internet Explorer 8.
After you click in the Instant Search box, a QuickPick menu is displayed. By default, the QuickPick menu shows icons for as many as nine search providers, making it easy to switch between providers. To see more search providers in the QuickPick, resize the Instant Search box. You can use the same term to search across these providers without having to navigate to each provider's Web site.
.gif)
Figure 5. The QuickPick menu.
Press Enter to use the current search provider, or you can select a provider from the QuickPick menu to perform the search.
If the search provider you use supports search suggestions, then search suggestions appear as you type. For example, if you search for "Xbox" using Live Search, you might see the following list of suggestions and history.
.gif)
Figure 6. Live Search Suggestions drop-down menu.
The top part of the suggestion menu is the AutoComplete section that shows recent searches that match your current search term. The second part of the suggestion menu is the Suggestions section that lists search suggestions provided by the current search provider. The third part of the suggestion menu is the History section that lists previous searches showing Web site titles and URLs that match the current search term. Matching terms are highlighted. You can select a matching term to search. The QuickPick menu displayed at the bottom of the menu so that you can switch between search providers.
Internet Explorer 8 enables search providers to display visual suggestions. A visual suggestion displays an image of the text. Search providers can supply a small image and text or just an image which can be mixed in with regular text suggestions. The following picture shows visual and text suggestions for the term "Xbox".
.gif)
Figure 7. Xbox visual and text search suggestions
In addition, a search provider can offer instant answers to your search term. With instant answers, your provider can take you directly to the information you are looking for rather then to a search results page. This can make your search more efficient.
Search Using Accelerators
New to Internet Explorer 8 is the concept of Accelerators. Accelerators enable you to access service providers anywhere on the page. Every time you add a search provider to your list, Internet Explorer 8 automatically converts it to an Accelerator. To use this feature, highlight the text you want to search for and click the Accelerators icon
that appears in the upper-right corner of your selection. A condensed list of the Web services you have installed is displayed. Among them is your default search provider. To use a different search provider, click More Accelerators. The following picture shows the expanded More Accelerators menu.
.gif)
Figure 8. The More Accelerators menu showing available Web services.
Find on Page
The Find on Page feature is another improvement to the user experience in Internet Explorer 8. To start a search, click the Find option next to the QuickPick menu or use the shortcut key CTRL+F. The Find on Page feature searches the current page using the terms in the Instant Search box. As the following picture illustrates, all matches on the page are highlighted, and the first matching term is selected. The number of matches on the page is also displayed.
.gif)
Figure 9: The Find on Page feature
Tips and Tricks
Here are some other features and hints not covered above.
- Search history can be deleted. You can delete previous search terms and history pages from the History list. This is useful when you do not want suggestions on terms you misspelled. As you type in the address bar or the Instant Search box, search suggestions are displayed. Mouse over the item you want to delete, and an X appears next to the item, as shown in the following picture. Click the X to delete the item from the list.
.gif)
Figure 10. Deleting an item from the History list
- The Instant Search box can be resized. To resize the Instant Search box, move the pointer to the left edge of the Instant Search box. When the horizontal pointer appears, drag to resize the Instant Search box.
Web Developer Search Features
Sites can now advertise search providers so that users can perform searches directly from the Internet Explorer frame without first having to navigate to a particular site. The default search provider is also used to perform searches from the address bar. The first step in promoting your search provider in Internet Explorer 8 is to enable users to install your Web site as a search provider in the search box. To do this, there are two steps you need to take. The first step is to create an OpenSearch Description
file for your search provider and the second step is to expose the description file on your Web site so that users can install it.
This section focuses on helping developers understand and take advantage of Internet Explorer 8 search features to improve user search experience. This section covers the following topics:
Creating an OpenSearch Description File
Before promoting your services and provide users with options to install your search provider, you must create an OpenSearch Description
file. OpenSearch Description files are small XML files that describe your search provider to Internet Explorer 8. The following table describes the values in the OpenSearch Description file.
| Value | Description |
|---|
| Search Provider Name (required) | The name that is displayed in the Instant Search box when your provider is selected. |
| Search URL (required) | The URL for basic search queries to your search provider. It can be a relative or absolute URL. |
| Icon (optional) | A favicon file for your search provider. This icon is displayed next to the provider name in the Instant Search box. The icon must be a valid shortcut icon file. Click here for instructions on how to Add a Shortcut Icon to a Web Page. |
| Suggestions URL (XML) (optional) | This is the URL where XML-based suggestions can be retrieved. |
| Suggestions URL (JSON) (optional) | This is the URL where JavaScript Object Notation (JSON) suggestions can be retrieved. |
The following sample OpenSearch Description file contains the search provider's name, URL, and icon.
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>My Custom Search</ShortName>
<Url type="text/html" template="http://example.com/?q={searchTerms}&source=IE"/>
<Image height="16" width="16" type="image/icon">http://example.com/mycustom.ico</Image>
</OpenSearchDescription>All OpenSearch Description files must include the search provider name and search URL. Without these elements, Internet Explorer 8 cannot install your search provider. All search URLs must contain "q={searchTerms}" somewhere in the query string. When Internet Explorer 8 navigates to this provider to get search results, "{searchTerms}" is replaced by the query string that the user typed into the Instant Search box. you should include an icon within the OpenSearch Description file. If Internet Explorer 8 cannot find an icon for your provider in your description file or at the root of your Web site, it will use a generic icon
to represent your search provider in the QuickPick menu.
A quick way to generate an OpenSearch Description file is to use a widget from the Windows Search Guide to Create Your Own XML file. Follow the instructions in the widget, and then click on the View XML link from step 5. The widget creates XML syntax similar to the preceding code snippet. Save the output to an XML file, and then upload the file to your Web server. Make sure you have a valid XML file, and that the "&" characters in your URL are escaped.
Note The widget only produce a basic XML file that you can use and customize. However, it does not generate any icon or suggestion URL. You would have to add those yourself.
Adding Search Suggestions to OpenSearch Description Files
In Internet Explorer 8, search providers can offer suggestions to users. By using the search suggestions, users can create better search terms and find what they are looking for faster. To offer search suggestions for JSON and XML format, add the following elements to your description file.
<Url type="application/x-suggestions+json" template="http://suggestions.example.com/?q={searchTerms}"/>
<Url type="application/x-suggestions+xml" template="http://suggestions.example.com/?q={searchTerms}"/>When you add additional URL elements, make sure the "text/html" type is first. The other types can follow in any order. By default, Internet Explorer uses the URL of "text/html" as the generic search URL when search suggestions are not available or not supported by earlier versions. Whenever possible, Internet Explorer 8 uses the URL for the XML suggestions format.
If users had added your search provider before it supported suggestions, they must add your search provider again. Internet Explorer 8 will detect that your search provider had already been installed but is now offering suggestions. The Add Search Provider dialog box will display an Upgrade Provider button and enable the checkbox for search suggestion.
Adding Preview To OpenSearch Description Files
All installed search providers are automatically converted to Accelerators. Accelerators support Previews and if you wish to support this feature of Accelerators you can add a Preview Url to your OpenSearch Description file as shown here:
<ie:PreviewUrl>http://example.com/preview/q={searchTerms}</ie:PreviewURL>With this elemented added to your OpenSearch Description file, when your search provider is converted to an Accelerator, that Accelerator will support Preview.
Promoting Search Providers
After you create your OpenSearch Description file, you can promote your services to users. There are two primary ways to promote search providers. The first option is to provide your users with a link or button that points to your description file. The users will need to take action to install your provider. The second option is to make your provider discoverable. It requires one line of code at the top of your web page and allows Internet Explorer 8 to discover your provider as users browse your site.
The following code adds a search provider when a user clicks a link.
<a href="#"
onclick="window.external.AddSearchProvider('http://www.example.com/provider.xml')"
>Add Search Provider Example</a>The code makes a call to the AddSearchProvider method. The AddSearchProvider method is available from the external object of window. When you run this code from an HTML page in Internet Explorer 8, the Add Search Provider dialog box is displayed.
Making Search Provider Discoverable
The second way to promote a search provider is to make the search provider discoverable. The OpenSearch specification describes how to advertise search providers by adding a link element to the head of the Web page. The following code enables Internet Explorer 8 to discover your search provider.
<link title="My Provider" rel="search"
type="application/opensearchdescription+xml"
href="http://www.example.com/provider.xml">
The rel attribute must be "search," and type must be "application/opensearchdescription+xml." The value of title is displayed in the Instant Search box drop-down menu. The href attribute contains an absolute or relative URL that specifies the location of the OpenSearch Description file.
Note Search providers must use the HTTP GET request method; the POST request method is not supported.
When the page is loaded in Internet Explorer 8, the drop-down arrow on the Instant Search box turns orange to indicate that new search providers have been added to the drop-down menu. The three newest discoverable search providers are listed; these must be installed before additional providers can be included in the list. When the user browses to another domain, the previously discovered search providers are removed. Users can try out the new providers before adding them to their list. When a user decides to install a search provider, the Add Search Provider dialog box is displayed.
Offering Search Suggestions
Starting with Internet Explorer 8, the Instant Search box supports search suggestions. With search suggestions, as the user is typing in the search box, Internet Explorer 8 can send requests to your search provider with the current query string and you can supply suggestions which might enable the user to create a better search term. Internet Explorer 8 supports two search suggestions formats: JSON format and XML format. The JSON format enables text-based search suggestions that can be augmented with descriptions and URL. The XML format enables all the content available with JSON suggestions, including as visual suggestions and section titles.
Note This section covers the formatting of individual suggestion responses only. To fully support search suggestions, you must generate these suggestions and provide the right suggestions at each request. Since this part of supported suggestions is unique to each provider, it is not addressed here.
Using JSON Suggestions Format
JSON search suggestions are returned as a JavaScript array of arrays. The array contains four values:
| Value | Description |
|---|
| Query string (required) | The search term that was requested. If the browser requested suggestions for "xbox," then the query string is "xbox". Returning the query string in the array ensures that the returned suggestions are for the requested search term. |
| Completions array (required) | The suggestions for the given query string. |
| Descriptions array (optional) | Alternate strings that provide additional information or context about a given completion. |
| Query URLs array (optional) | A list of URLs that should be used if the user selects a given suggestion. This acts as an instant answer to the search term by taking the user to the URL rather than a search results page. |
A JSON response must return the query string and the search suggestions in the completions array. The following is an example of a simple JSON response where the descriptions and query URLs are omitted.
["xbox",
["Xbox 360", "Xbox cheats", "Xbox 360 games"]]
Note A maximum of ten search suggestions are displayed at a time. Adding descriptions, visuals, and sections limits the number of suggestions that can be provided. It is important to send the most relevant suggestions at the beginning of the completions array.
To help users create better search terms, descriptions can be offered along with the suggestions. A query URLs might be offered as a form of an instant answer. When a query URL is offered, and the user clicks on that suggestion, Internet Explorer 8 takes the user to that query URL directly rather than to a search results page. The following is an example of a detailed JSON response.
["xbox",
["Xbox 360", "Xbox cheats", "Xbox 360 games"],
["The official Xbox website from Microsoft", "Codes and walkthroughs", "Games and accessories"],
["http://www.xbox.com","http://www.example.com/xboxcheatcodes.aspx", "http://www.example.com/games"]]
In this JSON response, the first search suggestion consists of the following elements:
- First element in the first array ("Xbox 360")
- First element in the second array ("The official Xbox website from Microsoft")
- First element in the third array ("http://www.xbox.com").
The preceding response produces the following results:
.gif)
Figure 11. JSON search suggestions
Using XML Suggestions Format
The preceding JSON response can be represented in XML suggestions format, as shown in the following example. This example contains the same suggestions response as in the preceding JSON suggestions and produces the exact same result. The Description and Url element of the Item element are optional and can be omitted.
<?xml version="1.0"?>
<SearchSuggestion>
<Query>xbox</Query>
<Section>
<Item>
<Text>Xbox 360</Text>
<Description>The official Xbox website from Microsoft</Description>
<Url>http://www.xbox.com</Url>
</Item>
<Item>
<Text>Xbox cheats</Text>
<Description>Codes and walkthroughs</Description>
</Item>
<Item>
<Text>Xbox 360 games</Text>
</Item>
</Section>
</SearchSuggestion>The JSON suggestion format does not allow section titles to be specified in the suggestion menu. In Internet Explorer 8, the section title will be the name of your search provider plus the word "Suggestions." For example, if your search provider is named "Joe's Search," then your suggestions would be titled "Joe's Search Suggestions." In the following example, the search provider is named "My Custom Search" and the title is displayed as "My Custom Search Suggestions." If you want to organize your suggestions in multiple sections, use the XML suggestions format. In addition to section titles, the XML suggestions format supports visual suggestions.
XML search suggestions support the same features as JSON search suggestions, and additional features that are not available in JSON. These additional features include the following:
- Customizing the title of the suggestions section.
- Splitting suggestions across multiple section separators.
- Including visual suggestions.
To customize section titles, you can add a "title" attribute to the Section element, or you can add a separator. Separators may or may not have a title. The following example adds a separator for "My Text Suggestions" and another separator without a title.
<?xml version="1.0"?>
<SearchSuggestion>
<Query>xbox</Query>
<Section>
<Separator title="My Text Suggestions"/>
<Item>
<Text>Xbox 360</Text>
<Description>The official Xbox website from Microsoft</Description>
<Url>http://www.xbox.com</Url>
</Item>
<Item>
<Text>Xbox cheats</Text>
<Description>Codes and walkthroughs</Description>
<Url>http://www.example.com/xboxcheatcodes.aspx</Url>
</Item>
<Item>
<Text>Xbox 360 games</Text>
<Description>Games and accessories</Description>
<Url>http://www.example.com/games</Url>
</Item>
<Separator />
<Item>
<Text>xbox 360 lowest price</Text>
</Item>
<Item>
<Text>xbox 360 news</Text>
</Item>
</Section>
</SearchSuggestion>The code above produces the following result.
.gif)
Figure 12. XML search suggestions with custom title and section separators
Offering Visual Suggestions
Search suggestions generally consist of text suggestions or related terms that users might want to search for. In Internet Explorer 8, the concept of a search suggestion has been expanded to include a query string, a link, or a visual suggestion. A visual suggestion includes an image. Your search provider can supply an image with text or just an image as a search suggestion for the user's search term. To add a visual suggestion to your response, add an Image element to the Item element of that suggestion. For example, to offer a visual suggestion for the term "Xbox," you might return the following:
<Separator title="My Visual Suggestions" />
<Item>
<Text>Xbox 360 Game Consoles</Text>
<Description>Game console systems and packages at a great deal.</Description>
<Image source="http://www.example.com/xboxconsole.jpg" alt="Xbox 360 Consoles" width="75" height="75"/>
<Url>http://www.example.com/</Url>
</Item>
<Item>
<Text>Xbox 360 Wireless Controller</Text>
<Image source="http://www.example.com/xboxcontroller.jpg" alt="Xbox 360 Wireless Controller" width="75" height="75"/>
</Item>
<Item>
<Text>Xbox 360 Live Games</Text>
<Image source="http://www.example.com/live.jpg" alt="Xbox 360 Live Games" width="75" height="75"/>
<Url>http://www.example.com/games.aspx?q="Xbox 360"</Url>
</Item>
The preceding code produces the following results.
.gif)
Figure 13. Xbox visual suggestions
This example offers a URL with two of the suggestions. Internet Explorer 8 takes the user directly to the page specified by the URL. If URL is not offered, then the value of the Text element ("Xbox 360 Wireless Controller") is used as the search term. If you want to offer a visual suggestion with no Text or Description, you must offer a URL so Internet Explorer 8 knows where to send the user.
By default, if you include text with an image, the text is centered vertically next to the image. By setting the align attribute value to "top," "middle," or "bottom," you can specify the text alignment of the Text element and Description element relative to the image.
To align your text, add the align attribute to your image element. The example below set the align attribute to "top".
<Image source="http://www.example.com/xboxconsole.jpg" alt="Xbox 360 Consoles" width="75" height="75" align="top"/>
Getting Dimensions for the Search Suggestions Menu
You should include the height and width of your image when you provide a visual suggestion. If you do not include these values, Internet Explorer 8 allocates a default space for the image and scales the image to fit within that space. The default amount of space, in this case, is the vertical equivalent of one line of text.
The Instant Search box can be resized, so the dimensions of the search suggestions drop-down menu may vary. To find out the dimensions of the search suggestions menu, you can add parameters to the OpenSearch Description URL that return the size of the search suggestions drop-down menu. Available parameters include the following.
| Parameter | Description |
|---|
| {maxWidth} | The width of the drop-down,in pixels. If the width of an image is larger than maxWidth, then the image will be scaled to fit within the allocated space. |
| {sectionHeight} | The height of the entire suggestions section. |
| {rowHeight} | The height of a single line of text, which is equivalent to one line of text. |
The following example shows these parameters added to the URL of the OpenSearch Description file.
<Url type="application/x-suggestions+xml"
template="http://search.mysite.com/suggestions/results.aspx?
q={searchTerms}&src={referrer:source?}&
maxwidth={maxWidth}&rowheight={rowHeight}&sectionHeight={sectionHeight}"
/>The folowing picture identifies the area for each parameter.
.gif)
Figure 14. Search suggestions menu parameters
Identifying Search Referrers
Starting from Internet Explorer 7 the OpenSearch Referrer Extension
is supported. When the user initiates a search, Internet Explorer adds a referrer attribute to the search query that indicates whether the search was initiated by the Instant Search box or by the address bar. If the search was initiated by the Instant Search box, the referrer attribute is set to IE-SearchBox. If the search was initiated from the address bar, either through a favorite or direct typing, the referrer attribute is set to IE-Address.
Remarks
Keep the following guidelines in mind.
- A Web site cannot automatically launch the Add Search Provider dialog box. It is locked down in the same way that a pop-up blocker locks down Web sites, and can only be launched as the direct result of a user action.
- Titles should be short, ideally, 16 characters or less. This string is used by the Instant Search menu. If the title is longer then the search box, it might be clipped.
- The title in the link tag should be the same title used by the XML description file. These strings must match so that Search Discovery recognizes that a provider has been installed so that the Instant Search box drop-down arrow doesn't turn orange, or an installed provider doesn't add itself to the list of discovered providers.
- When a user restores default Internet Explorer settings, all custom search providers are removed.
- If you are using scripts to add aprovider, you may also want to call the IsSearchProviderInstalled helper method to check if your provider has already been installed.
- When you create description files, make sure the file is of valid XML syntax and that all characters in your query strings are encoded and that all "&" characters are escaped to "&".
- Since users can resize the Instant Search box, you can query Internet Explorer 8 to return the search suggestions drop-down dimensions by adding parameters to the URL of your XML description file.