Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

tabs.sendRequest()

This method has been deprecated. Use tabs.sendMessage() instead.

Sends a single request to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The extension.onRequest event is fired in each content script running in the specified tab for the current extension.

Syntax

chrome.tabs.sendRequest(
  tabId,                   // integer
  request,                 // any
  function(response) {...} // optional function
)

This API is also available as browser.tabs.sendRequest() in a version that returns a promise.

Parameters

tabId
integer.
request
any.
responseCallbackOptional
function. The function is passed the following arguments:
response
any. The JSON response object sent by the handler of the request. If an error occurs while connecting to the specified tab, the callback will be called with no arguments and runtime.lastError will be set to the error message.

Browser compatibility

Chrome Edge Firefox Firefox for Android Opera
Basic support Yes No No No No

Examples

Acknowledgements

This API is based on Chromium's chrome.tabs API. This documentation is derived from tabs.json in the Chromium code.

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

Document Tags and Contributors

 Contributors to this page: Makyen, Jeremie, wbamberg, rolfedh
 Last updated by: Makyen,