extension.sendRequest()

This method has been deprecated. Use runtime.sendMessage instead.

Sends a single request to other listeners within the extension. Similar to runtime.connect, but only sends a single request with an optional response. The extension.onRequest event is fired in each page of the extension.

Syntax

browser.extension.sendRequest(
  extensionId,             // optional string
  request,                 // any
  function(response) {...} // optional function
)

Parameters

extensionIdOptional
string. The extension ID of the extension you want to connect to. If omitted, default is your own extension.
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 extension, the callback will be called with no arguments and runtime.lastError will be set to the error message.

 

Browser compatibility

EdgeFirefoxChromeOpera
Basic support?NoYesNo
Firefox
Basic supportNo

Acknowledgements

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

Document Tags and Contributors

 Contributors to this page: wbamberg
 Last updated by: wbamberg,