Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to change the default search engine with a Google Chrome extension?

I have to develop an extension which adds a new search engine and sets it as default.

I have not found anything in https://developer.chrome.com/extensions/

Is it possible?

like image 240
michele Avatar asked Oct 14 '25 04:10

michele


2 Answers

You cannot set the default search engine to an extension-defined search engine:

Allowing an extension-added engine to be default is problematic because there's no clear fallback path for when the extension is uninstalled -- especially if the previous default (or worse, all other engines) are deleted first. This could allow us to get into a "no engine as default" case which Chrome isn't prepared to handle.

Chrome does support keywords directly, e.g. add a search engine for Wikipedia and make the keyword "w", and "w foo" will search Wikipedia for foo. Perhaps you can use this native capability as a workaround?

You can add a new keyword-based search provider via the chrome.omnibox API (but you cannot make it the default).

like image 148
apsillers Avatar answered Oct 16 '25 16:10

apsillers


It is now possible to create a new search engine and even set it as default; however, the method to do so it only available on Windows according to Chrome docs:

Settings overrides are a way for extensions to override selected Chrome settings. The API is available only on Windows.

The gist is as follows: if your extension's Web Store listing is associated to the verified domain used in search, you can specify it in the manifest.

That means you can only do so if you control the search engine page to the point of being able to verify it for your account in Webmaster Tools.

The following is a minimal configuration:

"chrome_settings_overrides": {
  "name": "Example search",
  "keyword": "example",
  "search_url": "https://example.com/s?={searchTerms}",
  "favicon_url": "https://example.com/favicon.ico",
  "encoding": "UTF-8",
  "default": true
},
like image 36
Xan Avatar answered Oct 16 '25 17:10

Xan