8

求教 Chrome 扩展 如何跳转到本地浏览器默认的搜索引擎?就像在地址栏输入搜索一样。

 2 years ago
source link: https://www.v2ex.com/t/795440
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
求教 Chrome 扩展 如何跳转到本地浏览器默认的搜索引擎?就像在地址栏输入搜索一样。

V2EX  ›  程序员

求教 Chrome 扩展 如何跳转到本地浏览器默认的搜索引擎?就像在地址栏输入搜索一样。

  cocong · 1 天前 · 290 次点击

Felldeadbird

Felldeadbird   1 天前

不知道这个思路对不对。你扩展做一个输入框。 执行 window.location.href = "输入框的内容" 。 或者 window.open 形式? 这样 URL 不就填入地址了?

cocong

cocong   1 天前

@Felldeadbird 不行的,浏览器会解析成相对地址,所以打开的是扩展而不是使用默认搜索引擎搜索内容。

Felldeadbird

Felldeadbird   16 小时 19 分钟前

不行的话,转一个思路。看看扩展有没有 获取浏览器设置的 API 。有的话就读取默认的搜索引擎设置。

cocong

cocong   15 小时 15 分钟前

@debuggerx 哇,还真有,不过要 Chrome 87 才支持,难怪以前没看到,太感谢了。

关于   ·   帮助文档   ·   FAQ   ·   API   ·   我们的愿景   ·   广告投放   ·   感谢   ·   实用小工具   ·   1303 人在线   最高记录 5497   ·  

创意工作者们的社区

World is powered by solitude

VERSION: 3.9.8.5 · 14ms · UTC 17:47 · PVG 01:47 · LAX 10:47 · JFK 13:47
♥ Do have faith in what you're doing.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK