What algorithm does google use to make Chrome browser's address bar to act as a default search bar for many websites?

后端 未结 2 1069
-上瘾入骨i
-上瘾入骨i 2021-02-04 06:21

I am wondering what algorithm does google use to make chrome browser\'s address bar to act as a default search bar for many websites like SO, Quroa etc. but not for facebook, me

2条回答
  •  臣服心动
    2021-02-04 06:49

    This feature is powered by what is known as OpenSearch. It allows you to specify how queries are supposed to be formed when searching a website. You can read the documentation here: http://www.opensearch.org/Home

    For example, StackOverflow has the following in their HTML source code:

    
    

    If you then open the file /opensearch.xml you can see the following:

    
    
      Stack Overflow
      Search Stack Overflow: Q&A for professional and enthusiast programmers
      UTF-8
      http://sstatic.net/stackoverflow/img/favicon.ico
      
    
    

    The most important part is the line that specifies the search term string in line 7.

提交回复
热议问题