Question

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.

Was it helpful?

Solution

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 (no auto-suggestion) 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!

OTHER TIPS

http://msdn.microsoft.com/en-us/library/cc849066(v=vs.85).aspx now appears to be the supported method for IE8+

Download the IE8 SDK from http://www.microsoft.com/download/en/details.aspx?id=22015 and use the openservice.h and openservice.idl files to call the relevant functions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top