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.getCurrent()

Get a tabs.Tab containing information about the tab that this script is running in.

You can call this function in contexts where there is a browser tab, such as an options page. If you call it from a background script or a popup, it will return undefined.

Syntax

chrome.tabs.getCurrent(
  function(tab) {...} // function
)

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

Parameters

callback
function. The function is passed the following arguments:
tabOptional
tabs.Tab. Information about the current tab.

Browser compatibility

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

Examples

Get information about the current tab:

function onGot(tabInfo) {
  console.log(tabInfo);
}

chrome.tabs.getCurrent(onGot);

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, wbamberg
 Last updated by: Makyen,