Welcome What's new in Chrome extensions Getting started API Reference Samples

chrome.search

  • Description

    Use the chrome.search API to search via the default provider.

  • Permissions
    search
  • Availability
    Chrome 87+

Summary

Types

Disposition

Type

"CURRENT_TAB"

,

"NEW_TAB"

,
or

"NEW_WINDOW"

QueryInfo

Properties

  • disposition

    Disposition optional

    Location where search results should be displayed. CURRENT_TAB is the default.

  • tabId

    number optional

    Location where search results should be displayed. tabId cannot be used with disposition.

  • text

    string

    String to query with the default search provider.

Methods

query

chrome.search.query(
  queryInfo: QueryInfo,
  callback?: function,
)
Promise

Used to query the default search provider. In case of an error, runtime.lastError will be set.

Parameters

  • queryInfo
  • callback

    function optional

    The callback parameter looks like: () => void

Returns

  • Promise<void>

    Pending

    This only returns a Promise when the callback parameter is not specified, and with MV3+. The type inside the Promise is the same as the 1st argument to callback.