You are here: Reference > JavaScript > client-side > browser > methods > IsSearchProviderInstalled (external, sidebar)

IsSearchProviderInstalled method (external, sidebar)

Browser support:
7
Returns an integer that represents whether the specified search provider is installed and whether it is the default.
Note: The IsSearchProviderInstalled method is supported in Internet Explorer since version 7.
Use the AddSearchProvider method to install a search engine plugin into the browser application.

Syntax:

object.IsSearchProviderInstalled (URL);
You can find the related objects in the Supported by objects section below.

Parameters:

URL
Required. String that specifies a prefix of the search provider's URL to search for. An installed search provider matches this value if its URL starts with the specified prefix. The requested search provider should be in the same domain that the page is served from. Invoking the IsSearchProviderInstalled method with a prefix of a different domain raises an access denied exception.

Return value:

Integer. One of the following values:
0 No installed search provider was found with the specified prefix.
1 A matching search provider is installed, but it is not the default.
2 A matching search provider is installed and set as the default.

Example HTML code 1:

This example shows how to check for a search provider:
Code
searchProvider.xml
<head>
    <script type="text/javascript">
        function IsInstalled () {
            if (window.external && window.external.IsSearchProviderInstalled) {
                var isInstalled = window.external.IsSearchProviderInstalled ("http://www.dottoro.com");
                if (!isInstalled) {
                    window.external.AddSearchProvider ("searchProvider.xml");
                }
            }
            else {
                alert ("Your browser does not support the IsSearchProviderInstalled method!");
            }
        }
    </script>
</head>
<body>
    <button onclick="IsInstalled ()">Add search engine if not installed</button>
    <br /><br />
    To manage search engines, open the drop-down menu of your browser's Search Box (Firefox and Internet Explorer)
    or select Options/Basics/Default Search/Manage (Google Chrome).
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content