Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use the external.IsSearchProviderInstalled function?

How is the function external.IsSearchProviderInstalled meant to be used? I've tried things like external.IsSearchProviderInstalled('http://www.google.com') but I keep getting an Error in Chrome?

What is the function external.IsSearchProviderInstalled? How should it be used in Chrome?

like image 739
Randomblue Avatar asked May 29 '26 13:05

Randomblue


1 Answers

The spec for IsSearchProviderInstalled is here: http://dev.w3.org/html5/spec-author-view/system-state-and-capabilities.html#dom-external-issearchproviderinstalled

The most likely reason you are getting an error is because "Only results pages on the same domain as the script that calls this method are checked." So you can only check if providers on your domain are installed.

e.g. If you go to https://www.google.com, open the Javascript console and say external.IsSearchProviderInstalled('https://www.google.com') you'll get back a 0, 1 or 2 depending on your search provider settings.

However, if you try the same call on a different domain, an Error is thrown. It is a poorly defined generic error, but there is a FIXME in the Chromium code to respond with something more descriptive (c.f. ExternalExtensionWrapper::IsSearchProviderInstalled in src/chrome/renderer/external_extension.cc)

like image 111
James deBoer Avatar answered May 31 '26 05:05

James deBoer