extension.sendRequest()

Deprecated
This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

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

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

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

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

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxOperaFirefox for Android
Basic support
DeprecatedNon-standard
Chrome Full support YesEdge No support NoFirefox No support NoOpera No support NoFirefox Android No support No

Legend

Full support  
Full support
No support  
No support
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.
Deprecated. Not for use in new websites.
Deprecated. Not for use in new websites.

Acknowledgements

This API is based on Chromium's chrome.extension API. This documentation is derived from extension.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: ExE-Boss, wbamberg, Makyen
Last updated by: ExE-Boss,