用于获取所有搜索提供程序/引擎列表的API?(API to get the list of all search providers/engines?)

编程入门 行业动态 更新时间:2024-10-08 08:24:19
用于获取所有搜索提供程序/引擎列表的API?(API to get the list of all search providers/engines?)

我正在开发Opera扩展。 在某些时刻,它允许用户执行搜索。 现在我将chrome.tabs.update与{ url: `https://google.com/search?q=${encodeURIComponent(query)}`} chrome.tabs.update ? chrome.tabs.update { url: `https://google.com/search?q=${encodeURIComponent(query)}`} 。 这不是用户友好的。 更好的方法是在扩展程序的选项页面中维护用户可编辑的网址列表,例如https://google.com/search?q=或https://ca.search.yahoo.com/search?p=并允许用户可以在它们之间进行选择,但我真的不想重新发明轮子。

基于Chromium的浏览器都具有用户可配置的搜索引擎/提供程序,我希望允许用户在它们之间进行选择或仅使用默认值。 为了实现这一点,我基本上需要两个API函数:

获取所有已配置搜索引擎列表的函数;

获取默认引擎的函数。

我没有在API文档中找到与我的问题类似的内容。

顺便说一句,Opera还有一个无证件的chrome.search函数(Chromium没有),但无论用户的默认搜索引擎设置如何,它总是通过Google进行搜索。

谢谢。

PS。 如果有更合适的地方可以提出这个问题,请告诉我。

I am developing an Opera extension. At some moment it allows the user to perform search. Now I use chrome.tabs.update with { url: `https://google.com/search?q=${encodeURIComponent(query)}`}. This is not user friendly. The better approach is to maintain a user-editable list of URLs like https://google.com/search?q= or https://ca.search.yahoo.com/search?p= in the extension's options page and allow the user to choose between them, but I really don't want to reinvent the wheel.

Chromium-based browsers all have user-configurable search engines/providers, and I want to allow the user to choose between them or just use the default. To make that possible, I basically need two API functions:

a function to get the list of all configured search engines;

a function to get the default engine.

I didn't find anything similar to my problem in the API docs.

BTW, Opera also has an undocumented chrome.search function (Chromium has none), but it always searches via Google regardless of the user's default search engine setting.

Thanks.

PS. If there is a more appropriate place to ask this question, please tell me.

最满意答案

我没有在API文档中找到与我的问题类似的内容。

不幸的是,因为没有一个。

有一个相关的旧功能请求 ,没有真正的活动。

I didn't find anything similar to my problem in the API docs.

Because there isn't one, unfortunately.

There is a relevant old feature request with no real activity.

更多推荐

本文发布于:2023-04-29 09:36:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1335594.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:引擎   程序   列表   API   engines

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!