views:

439

answers:

1

This seems like a basic task, but I'm unable to find a solution for some reason.

How can I programmatically install a search provider in Internet Explorer? I'm using NSIS for my installer.

+1  A: 

There doesn't appear to be any officially documented way to manually install an Internet Explorer search service. The official method appears to be to implement

window.external.AddSearchProvider("URL")

which, when viewed with IE 7+, will prompt the user to install the search service.

However, with a little poking around, it appears that IE 8, at least, is installing search services in the following location (using NSIS variables):

$LOCALAPPDATA\Microsoft\Internet Explorer\Services\

Check out that folder (after installing at least one search service) to see the structure. It looks like you just need an .ico and (possibly) an OpenSearch .xml file. You'll also need some registry settings (described below).

However, for simple searches it looks like you can get away with just setting up your search service in the registry. The location of the search settings in the registry is:

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchScopes\{guid}

where {guid} is a GUID identifying the search service. Again, just examine what other search services have done as there doesn't appear to be any official documentation for this kind of thing. Google, for example, just specifies a URL for their service using OpenSearch substitutions in the URL to achieve the magic.

NOTE: since there is apparently no public documentation on this, it's likely that all of this could change in the future. If you don't use the official method (in the browser) you could end up supporting multiple different install methods.

Good luck!

Naaff
Thanks. I'll start with that. I'll let you know how it turns out.
Andrew
In response to your comment: I haven't gotten a chance to try it yet, but your information will definitely help when I get around to it. I'll comment here when I do try it out.
Andrew