通过脚本在Chrome上设置默认搜索提供程序 [英] Setting the Default Search Provider on Chrome via a script
问题描述
我试图通过脚本(在OS X和Windows上)设置各种Google Chrome浏览器偏好设置。通过编辑用户的应用程序数据文件夹中的首选项和书签json文件,我可以成功设置一些首选项,并添加书签。但是,当我尝试设置新的默认搜索提供程序时,浏览器会自动恢复为Google搜索。
<首选项>文件中的默认搜索提供程序节点如下所示: / p>
default_search_provider:{
enabled:true,
encodings:UTF-8 ,
icon_url:http://www.google.com/favicon.ico,
id:2,
instant_url:{google: baseURL} webhp?{google:RLZ} sourceid = chrome-instant& ie = {inputEncoding}& ion = 1 {searchTerms}& nord = 1,
keyword:google.com,
name:Google,
prepopulate_id:1,
search_url:{google:baseURL} search?{google:RLZ} {google:acceptedSuggestion} { google:originalQueryForSuggestion} sourceid = chrome& ie = {inputEncoding}& q = {searchTerms},
suggest_url:{google:baseSuggestURL} search?client = chrome& hl = {language}& q = {searchTerms}
为了添加我所需的搜索专业人员vider,我只是手动添加它(通过扳手菜单),查看此操作对json文件的影响,然后编写脚本来模仿这些更改。但是,当我通过脚本对其进行更改时,默认搜索提供程序用于第一次搜索,但在下一次启动Chrome时重置。我在这里错过了什么?
code> file,这是一个sqlite数据库。要添加搜索引擎,请向'关键字' code> table。
表。
要更改默认搜索引擎,请在<$ c $内编辑'默认搜索提供程序ID
'值c>'meta'
I am attempting to set various Google Chrome preferences via a script (on both OS X and Windows). I can successfully set a number of preferences, and add bookmarks, by editing the Preferences and Bookmarks json files in the user's Application Data folder. However, when i attempt to set a new default search provider, the browser automatically reverts to Google search.
The default search provider node in the Preferences file looks like this:
"default_search_provider": {
"enabled": true,
"encodings": "UTF-8",
"icon_url": "http://www.google.com/favicon.ico",
"id": "2",
"instant_url": "{google:baseURL}webhp?{google:RLZ}sourceid=chrome-instant&ie={inputEncoding}&ion=1{searchTerms}&nord=1",
"keyword": "google.com",
"name": "Google",
"prepopulate_id": "1",
"search_url": "{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}",
"suggest_url": "{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}"
}
In order to add my desired search provider, I've simply added it manually (via the wrench menu), viewed the effect of this action on the json file, and then written a script to mimic these changes. However, when I change it via a script, the default search provider is used for the first search, but then resets the next time chrome is started. What am i missing here?
as mentioned, you should edit the 'Web Data'
file, which is an sqlite database.
To add a search engine, add an entry to the 'keywords'
table.
To change the default search engine, edit the 'Default Search Provider ID
' value inside the 'meta'
table.
这篇关于通过脚本在Chrome上设置默认搜索提供程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!