Search Providers: Best Practices on Setting the Default
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.
#include <windows.h>
#include <atlbase.h>
#include <openservice.h>
HRESULT hr = E_FAIL;
BOOL fComInitialized = FALSE;
if (S_OK == CoInitialize(NULL))
{
fComInitialized = TRUE;
//Open a handle to the OpenService manager
CComPtr<IOpenServiceManager> spManager;
hr = spManager.CoCreateInstance(CLSID_OpenServiceManager);
if (SUCCEEDED(hr))
{
CComPtr<IOpenService> spService;
//Install my search provider
//URL-OF-SERVICE: See https://www.opensearch.org/Specifications/OpenSearch/1.1#OpenSearch_description_elements
hr = spManager->InstallService(URL-OF-SERVICE, &spService);
if (hr==S_OK)
{
//Request that the user changes their search default
hr = spService->SetDefault(TRUE, NULL);
}
}
}
if (fComInitialized)
{
CoUninitialize();
}
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
Programmer Writer
Internet Explorer
Comments
Anonymous
January 01, 2003
Thanks for that. I'm lovin it browserAnonymous
January 01, 2003
Will the Windows 7 phone really recognize phone numbers? It's pretty miraculous if that's true, I've been looking for a solution like that for such a long time.Anonymous
January 01, 2003
The comment has been removedAnonymous
February 17, 2010
This is all very good but it doesn't explain what version of IE will ship in the Windows Phone 7? (PS worst name ever after the proposed "IE7+" name)Anonymous
February 17, 2010
Thanks for clarifying this and providing a clear example.Anonymous
February 17, 2010
@evan Really? An article that had nothing to do with Windows Phone 7 didn't discuss Windows Phone 7? Shocking. Now that you mention it, it didn't discuss unicorns or leprechauns either. Thank goodness you said something.Anonymous
February 17, 2010
The comment has been removedAnonymous
February 17, 2010
Great article! Developers will appreciate this! @carlos, maybe the IE team would publish some insight about that features soon, like in this post: http://blogs.msdn.com/ie/archive/2010/02/01/w3c-svg-working-group-update-for-january-2010.aspx Best regards!Anonymous
February 17, 2010
The comment has been removedAnonymous
February 17, 2010
The browser on Windows Phone 7 will automatically recognize phonenumbers and make them callable and will also recognize adresses which will be mappable trough Bing maps. This is functionality that is not included in the current default deskptop IE browsers.Anonymous
February 17, 2010
The comment has been removedAnonymous
February 18, 2010
hi, As i do not know another place to ask my question, i ask it here. Please forgive me. Why in IE8 the Save menu item is disabled? Why the save As menu item has not shortcut? There are simple things that can save a lot of time. Regards, BehzadAnonymous
February 18, 2010
Just give me a way to block all changes to IE - including installation of add-ons (BHOs) and toolbars and changing of settings by external programs. Make settings change-able only from within IE (including changing search providers). And toolbars and BHOs will ask to be enabled on first run of IE after their installation.Anonymous
February 19, 2010
the only reason why is because they dont probably do any windows embedded work. & they never even spotlighted zune hd's browser either so i doubt they will start nowAnonymous
February 19, 2010
The comment has been removedAnonymous
February 19, 2010
The comment has been removedAnonymous
February 20, 2010
The comment has been removedAnonymous
February 21, 2010
The comment has been removedAnonymous
February 21, 2010
@Ian agree with you about everything you said there MS: fix your captcha, thought it was just some wierd thing in my environment, but I always have to generate the captcha twice before it is accepted...Anonymous
February 21, 2010
The comment has been removedAnonymous
February 22, 2010
Thanks Duc, I appreciate your post and have updated my code to use the recommended APIs. Thanks for the examples they helped out a lot.Anonymous
February 23, 2010
EM~~ I used this API, but got a link error: error LNK2001: unresolved external symbol _CLSID_OpenServiceManager Am I miss something?Anonymous
February 23, 2010
@wndrfll: You need to have the latest Windows SDK installed in order for the OpenServiceManager CLSID to be defined in the headers.Anonymous
February 23, 2010
@wndrfll: You need to have the latest Windows SDK installed in order for the OpenServiceManager CLSID to be defined in the headers.Anonymous
February 24, 2010
Windows Phone 7 a bad name? I thought google was a bad name... I rolled my eyes at Ipod...So let's just wait and see before we declare something named badly....(Ipad) is still a bad name..;-)