I am developing a chrome extension and my requirement is to detect the default search engine of Chrome web browser.
I have searched a lot over web but did not get any api to detect so.
I have also searched web to do so with Javascript/Jquery but not luck so far.
Please suggest me some way so that i can detect default search engine for Chrome browsers.
Make Google your default search engine Click the Tools icon at the far right of the browser window. Select Internet options. In the General tab, find the Search section and click Settings. Select Google.
Search engine changes can signal that malware may have infected your browser. Such malware is better known as a browser hijacker. It modifies your browser settings without your permission.
The only way I can think of is to query the HTML5 external interface.
Although this will not give you the users default search engine, you can query search engine URL's and see if he is using one you know the URL of.
installed = window.external.IsSearchProviderInstalled(url)
Returns a value based on comparing url to the URLs of the results pages of the installed search engines.
0: None of the installed search engines match url.
1: One or more installed search engines match url, but none are the user's default search engine.
2: The user's default search engine matches url.
But be aware of the following:
The url is compared to the URLs of the results pages of the installed search engines using a prefix match. Only results pages on the same domain as the script that calls this method are checked.
Which means you can only check if the browser is on the site you are querying.
So if you surf to https://www.google.com and run the following in the console:
external.IsSearchProviderInstalled("https://www.google.com")
a 2 will be returned, if you run the same in the console on another URL than the one you are querying, you will get an error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With