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

tabs.sendRequest()

この記事はまだボランティアによって 日本語 に翻訳されていません。ぜひ MDN に参加して翻訳を手伝ってください!

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.

ドキュメントのタグと貢献者

 このページの貢献者: Makyen, Jeremie, wbamberg, rolfedh
 最終更新者: Makyen,