我试图通过脚本(在OS X和Windows上)设置各种Google Chrome偏好设置.通过编辑用户的Application Data文件夹中的Preferences和Bookmarks json文件,我可以成功设置多个首选项并添加书签.但是,当我尝试设置新的默认搜索提供程序时,浏览器会自动恢复为Google搜索.
Preferences文件中的默认搜索提供程序节点如下所示:
"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}"
}
Run Code Online (Sandbox Code Playgroud)
为了添加我想要的搜索提供程序,我只需手动添加它(通过扳手菜单),查看此操作对json文件的影响,然后编写一个脚本来模仿这些更改.但是,当我通过脚本更改它时,默认搜索提供程序将用于第一次搜索,但随后会在下次启动chrome时重置.我在这里失踪了什么?
| 归档时间: |
|
| 查看次数: |
8765 次 |
| 最近记录: |