Add Search Engine URL in Chrome

I have a local search engine supported by elasticsearch and the subtle nodejs search API. I want to be able to search for these documents from Google Chrome (assemblies available from Google, not Chromium) directly. In this case, I will use chrome ONLY with this search engine, so I do not want to use the OmniBox keyword search API. I need the same behavior as when choosing the default search engine in chrome. What does it mean

  • Start typing in OmniBox and it will display a list of offers.
  • Click and enter the search results page.

I got # 2 by adding a new search engine in the settings and submitting a search query. I can't get # 1 to work.

Two URLs set by my server:

Things I tried:

  • Added a search engine using window.externals.AddSearchProvider with an OpenSearchDescription.xml link. XML has a suggestion URL.

  • Tried to write a background extension using OmniBox, but it doesn’t allow me to search without using a keyword

I searched in Chromium and found this JSON file

https://code.google.com/p/chromium/codesearch#chromium/src/components/search_engines/prepopulated_engines.json&q=prepopulated&sq=package:chromium&l=1

But I don’t know how to use it (or if it is possible to do it in official Chrome builds).

+5
source share
2 answers

I finally found a solution.

The link to opensearch.xml can be used as a link in the header section of an HTML page. It contains two URL patterns, one for search results and one for suggestions.

Details can be found here: Opensearch Document Specs .

As soon as I updated my index.html and opened the page in Chrome, Chrome automatically added a new search engine. He didn’t show that there is an offer URL in Settings> Manage Search Engines.

Then I selected my engine as the default search engine by clicking "Set as Default" and performed! Now I can see all the search suggestions in omnibox without using a keyword.

+3
source

There is a mechanism for setting overrides for Chrome Extensions, which is not known, which can achieve what you want , but:

  • At least according to the docs, it only works with Windows .
  • You won’t be able to post the extension if you cannot verify the site in Webmaster Tools. Otherwise, you are stuck in unpacked installations.
0
source

Source: https://habr.com/ru/post/1242419/


All Articles