tabs.captureVisibleTab()

Captures the visible area of the currently active tab in the specified window. You must have <all_urls> permission to use this method.

Syntax

browser.tabs.captureVisibleTab(
  windowId,               // optional integer
  options,                // optional extensionTypes.ImageDetails
  function(dataUrl) {...} // function
)

Parameters

windowIdOptional
integer. The target window. Defaults to the current window.
optionsOptional
extensionTypes.ImageDetails.

Values of this type are objects. They contain the following properties:

formatOptional
extensionTypes.ImageFormat. The format of the resulting image. Default is "jpeg".
qualityOptional
integer. When format is "jpeg", controls the quality of the resulting image. This value is ignored for PNG images. As quality is decreased, the resulting image will have more visual artifacts, and the number of bytes needed to store it will decrease.
callback
function. The function is passed the following arguments:
dataUrl
string. A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display.

Browser compatibility

EdgeFirefoxChromeOpera
Basic support?47.0Yes33
Firefox
Basic supportNo

Examples

Acknowledgements

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

Document Tags and Contributors

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