In a previous post, I introduced our Beta 1 search functionality and mentioned we would soon ensure you can add search providers to IE without executable code or a masterful knowledge of the registry. Now that we’ve released the Beta 2 Preview I’d like to take a few minutes to describe the two separate extensibility mechanisms we’ve introduced to make this happen: window.external.AddSearchProvider, and Search Discovery.
In Beta 2 any site can run a simple function prompting the user to add a search provider to IE. This script call will open a dialog giving the user control over what is included in their Toolbar Search Box.
Add Search Provider dialog
As you can see we’ve given an option on this dialog to make this provider your default. The default provider will be the one used from both the address bar and will also be the search provider we default to in the Toolbar Search Box when IE is launched.
Here’s the API:
window.external.AddSearchProvider(“URL”)“URL”: Link to the OpenSearch Description file for your search provider.
To use this, a site can simply include a call to AddSearchProvider and point it at an OpenSearch XML file:
<INPUT TYPE="button" VALUE="Provider" onClick='window.external.AddSearchProvider("http://<yoursite>.com/Provider.xml");'>
A site can simply include a call to AddSearchProvider:<INPUT TYPE="button" VALUE="Provider" onClick='window.external.AddSearchProvider("http://<yoursite>.com/Provider.xml");'>
The XML file could look something like this.
A site cannot automatically open this prompt. It will be locked down in the same way our pop-up blocker locks down websites. This essentially means that launching the dialog has to be the direct result of a user action. Also, if you are creating an XML file for your own provider make sure that the file actually loads in IE by itself without any errors. One trap people fall into is not escaping the “&” symbol in their XML file with “&” (Do a “View Source” on the example XML file to see how to do this properly).
The Beta 2 Preview also allows sites to advertise additional search providers that might be interesting to users. This works in a similar way to Feed Discovery.
When IE detects search providers via Search Discovery the Toolbar Search Box lights up to indicate there are more providers to see in the dropdown (we will offer the option for a sound notification as well – off by default). When the dropdown is opened up the suggested providers appear. Users can then add these providers permanently to the browser, or simply search to try out the provider first. We limit the number of discovered providers to a maximum of 3 providers not already installed on the machine.
Search button when a provider is discovered
The format for this is to use the <link> element in HTML:
<link title="Title" type="application/opensearchdescription+xml" rel="search" href="URL">Title: This is the title that will appear in the Toolbar Search Box dropdownURL: This will link to the OpenSearch Description of the search provider.type and rel must be as shown in the example
The other thing we are introducing in Beta 2 is the Windows Search Guide. This is a page where you can go and add providers yourself (we link to this site directly from the Toolbar Search Box dropdown – Click on “Find More Providers…”). So go download IE 7, check out the search guide, and try it out!
That’s it for today! I’m really excited to see sites start to support our new extensibility options! Until next time: Keep browsing!
- Aaron Sauvé