search.get() 编辑

Gets an array of all installed search engines.

Each search engine returned is identified with a name, which you can pass into search.search() to use that particular engine to make a search.

This is an asynchronous function that returns a Promise.

Syntax

var gettingEngines = browser.search.get()

Parameters

None.

Return value

A Promise that will be fulfilled with an array of search engine objects. Each search engine object may contain the following properties:

name
string. The search engine's name.
isDefault

boolean. true if the search engine is the default. Only one search engine can be the default at any given time.

aliasOptional

string. If a search engine has an alias, the user can search with a particular search engine by entering the alias in address bar before the search term. For example, if the Wikipedia engine has an alias "wk", the user can search Wikipedia for pandas by entering "wk pandas" in the address bar. The alias is sometimes also called a "keyword".

favIconUrlOptional

string. The search engine's icon, as a data: URL.

Browser compatibility

BCD tables only load in the browser

Examples

Get all installed search engines:

function retrieved(results) {
  console.log(`There were: ${results.length} search engines retrieved.`);
  for (let searchEngine of results) {
    console.log(JSON.stringify(searchEngine.name));
  }
}

browser.search.get().then(retrieved);

Example extensions

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:87 次

字数:3199

最后编辑:6年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文