Path: blob/main/files/en-us/mozilla/add-ons/webextensions/api/search/query/index.md
6567 views
------{{AddonSidebar()}}
Perform a search using the browser's default search engine.
The results are displayed in the current tab, a new tab, or a new window according to the disposition property or in the tab specified in the tabId property. If neither is specified, the results display in a new tab.
To use this function, your extension must have the "search" manifest permission.
To get the installed search engines, use {{WebExtAPIRef("search.get()")}}.
Syntax
Parameters
queryInfo:
object. An object with the following properties:disposition{{optional_inline}}:
string. The location where the search results are displayed. Valid values areCURRENT_TAB,NEW_TAB, andNEW_WINDOW. Defaults toNEW_TAB. Cannot be specified withtabId.
tabId{{optional_inline}}:
integer. An optional identifier for the tab you want to execute the search in. If this property is omitted, the search results are displayed in a new tab. Cannot be specified withdisposition.
text:
string. The search query.
Return value
None.
Examples
A search with the results shown in the current tab (default):
A search with the results shown in a new window:
A search with the results shown in the current tab:
{{WebExtExamples}}
Browser compatibility
{{Compat}}