Set the default search engine for Google Chrome

I need to develop an exe application that will replace the default Google Chrome search engine and configure my personal Google Chrome search engine after installing on this EXE.

+4
source share
2 answers

I don’t think there is an API for this via JavaScript or else.
However, this is possible using the SQLite data file and editing it.

The file in standard Windows 7 can be found at:
C:\Users\ABC\AppData\Local\Google\Chrome\User Data\Defaultand the file is called 'Web Data'.

, 'keywords'.
, 'Default Search Provider ID' 'meta'.

. , .

: Chrome script

+1

Preferences C:\Users\##UserName##\AppData\Local\Google\Chrome\User Data\Default.

JSON. :

   "default_search_provider": {
      "alternate_urls": [ "{google:baseURL}#q={searchTerms}", "{google:baseURL}search#q={searchTerms}", "{google:baseURL}webhp#q={searchTerms}" ],
      "enabled": true,
      "encodings": "UTF-8",
      "icon_url": "http://www.google.com/favicon.ico",
      "id": "2",
      "image_url": "{google:baseURL}searchbyimage/upload",
      "image_url_post_params": "encoded_image={google:imageThumbnail},image_url={google:imageURL},sbisrc={google:imageSearchSource},original_width={google:imageOriginalWidth},original_height={google:imageOriginalHeight}",
      "instant_url": "{google:baseURL}webhp?sourceid=chrome-instant&{google:RLZ}{google:forceInstantResults}{google:instantExtendedEnabledParameter}{google:ntpIsThemedParameter}{google:omniboxStartMarginParameter}ie={inputEncoding}",
      "instant_url_post_params": "",
      "keyword": "google.com",
      "name": "Google",
      "new_tab_url": "{google:baseURL}_/chrome/newtab?{google:RLZ}{google:instantExtendedEnabledParameter}{google:ntpIsThemedParameter}ie={inputEncoding}",
      "prepopulate_id": "1",
      "search_terms_replacement_key": "espv",
      "search_url": "{google:baseURL}search?q={searchTerms}&{google:RLZ}{google:originalQueryForSuggestion}{google:assistedQueryStats}{google:searchFieldtrialParameter}{google:bookmarkBarPinned}{google:searchClient}{google:sourceId}{google:instantExtendedEnabledParameter}{google:omniboxStartMarginParameter}ie={inputEncoding}",
      "search_url_post_params": "",
      "suggest_url": "{google:baseSuggestURL}search?{google:searchFieldtrialParameter}client={google:suggestClient}&xssi=t&q={searchTerms}&{google:cursorPosition}{google:zeroPrefixUrl}{google:pageClassification}sugkey={google:suggestAPIKeyParameter}",
      "suggest_url_post_params": "",
      "synced_guid": "CE1B8BFD-412B-4AB3-B597-325B07CA7E76"
   },

, , ! , , , Chrome Google.

+2

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


All Articles