This post describes a set of best practices for setting the default search provider. Our goal continues to be keeping users in control of their browser, following our published Guidelines and Requirements for add-on development.
If you write software that modifies Internet Explorer’s search settings or defaults through direct registry manipulation, your software may be contributing to user confusion and frustration.
Whenever a program tries to modify the default search provider through direct registry manipulation (e.g. modifying the DefaultScope registry key directly as described in an earlier blog post ), IE8 intercepts the change and prompts users to confirm what they want:
Figure 1: In this dialog, the software requests a search default change using the recommended SetDefault API and clear attribution is displayed. In this case, it is the Contoso Internet Toolbar software.
If multiple search providers try to reset the registry key every time it changes, it causes a confusing and frustrating user experience. The above dialog box will re-appear every time the key is modified directly.
IE8 includes a Search Provider Default configuration experience designed for this scenario. When your software uses the IOpenServiceManager API (to install a search provider) and the SetDefault API (to request users set it as their default), users will see clearer communication about what is happening. This transparency is an important part of the user being in control.
The following code sample shows how to install a search provider and request that the user set it as the default using the recommended APIs.
HRESULT hr = E_FAIL;
BOOL fComInitialized = FALSE;
if (S_OK == CoInitialize(NULL))
fComInitialized = TRUE;
//Open a handle to the OpenService manager
hr = spManager.CoCreateInstance(CLSID_OpenServiceManager);
//Install my search provider
//URL-OF-SERVICE: See http://www.opensearch.org/Specifications/OpenSearch/1.1#OpenSearch_description_elements
hr = spManager->InstallService(URL-OF-SERVICE, &spService);
//Request that the user changes their search default
hr = spService->SetDefault(TRUE, NULL);
When called, the SetDefault API will show the above dialog (See Figure 1 above) requesting the user to change their search default. The user can approve or deny this request from the software. If approved, the software can change the default setting. If denied, however, the software will not be allowed to change the user's default settings. The user can change the setting at any time by opening the Manage Add-ons window.
If the binary that is calling the SetDefault API is signed with a valid code signing certificate, the program name and publisher will be displayed in the Search Provider Default dialog box as in Figure 1 above. Code that calls SetDefault should be signed.
In summary, if your software monitors the DefaultScope registry key directly, please update your code to use the recommended APIs. This will allow the user to see the search provider default dialog only once and lets them be in full control of their default, in support of the Guidelines for add-on development.
If you are new to OpenSearch Extensibility and would like to learn how to offer your services or how to get started, check out the article Search Provider Extensibility in Internet Explorer.
Until next time,
Duc (Cash) Vo