Add suggestion URL for custom search engine in chrome

前端 未结 2 1174
时光取名叫无心
时光取名叫无心 2021-02-06 04:48

I have a local search engine backed by a elasticsearch and a thin nodejs API for search. I want to be able to search those documents from Google Chrome (builds available from Go

相关标签:
2条回答
  • 2021-02-06 05:20

    There is a Setting Overrides mechanism for Chrome Extensions, which is not widely known, which can achieve what you want, but:

    • At least according to the docs, it only works on Windows.
    • You won't be able to publish the extension unless you can verify the site in Webmaster Tools. Otherwise, you are stuck with unpacked installs.
    0 讨论(0)
  • 2021-02-06 05:36

    I finally found the solution.

    The opensearch.xml document reference can be used as a link in the head section of the HTML page. It contains two URL schemes, one for search results and other for suggestions.

    The 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. It didn't show that there is a suggestions URL under Settings > Manage search engines.

    Next, I chose my engine as the default search engine by clicking on Make Default and done! Now I can see all the search suggestions in the omnibox without using a keyword.

    0 讨论(0)
提交回复
热议问题