GitLab Loved by developers. Trusted by enterprises. Start your free 30 day trial.
▼ Filter
// mdn web docs
Mozilla > Add-ons > Browser extensions › JavaScript APIs › tabs › tabs.captureVisible Tab()
Browser extensions
‣ Getting started
▶ Concepts
► User interface
►How to
► JavaScript APIs
▸ Manifest keys
► Extension Workshop
Contact us
►Channels
References Guides
mdn
Your blueprint for a better internet.
moz://a Website Privacy Notice Cookies Legal
Plus
Syntax
JS
)
tabs.captureVisible Tab()
Creates a data URL encoding the image of an area of the currently active tab in the specified
window. You must have the <all_urls> permission to use this method. (Alternately, Chrome allows
use of this method with the activeTab permission and a qualifying user gesture).
This is an asynchronous function that returns a Promise.
Blog
Parameters
let capturing = browser.tabs.captureVisible Tab(
windowId,
// optional integer
options
// optional extensionTypes. ImageDetails
options Optional
windowId (Optional
integer. The target window. Defaults to the current window.
JS
30 day free trial
extensionTypes. ImageDetails.
}
Play
}
Return value
A Promise that will be fulfilled with a data URL which encodes the captured image. May be assigned
to the 'src' property of an HTML Image element for display. If any error occurs the promise will be
rejected with an error message.
Examples
Capture an image of the active tab in the current window, with default settings:
function onCaptured (imageUri) {
console.log (imageUri);
});
function onError(error) {
console.log(`Error: ${error}`);
Al Help
captureVisible Tab
browser.browser ion.onClicked.addListener(() => {
let capturing browser.tabs.captureVisible Tab();
capturing. then (onCaptured, onError);
ΒΕΤΑ
●
Browser compatibility
Report problems with this compatibility data on GitHub
Chrome
VULTR
5
MDN
Tip: you can click/tap on a cell for more information.
✓ Full support
Edge
>
15
See implementation notes.
About
Blog
Careers
Advertise with us
Community Participation Guidelines
Found a content problem with this page?
Edit the page on GitHub.
Report the content issue.
View the source on GitHub.
пн
◆ Firefox
<
47
Visit Mozilla Corporation's not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998-2024 by individual mozilla.org contributors. Content available under a Creative Commons license.
Want to get more involved? Learn how to contribute.
This page was last modified on Jan 22, 2024 by MDN contributors.
● Opera
* जे र
15
Support
Product help
Report an issue
Safari
>
Bring your digital vision to life with
Vultr High-Performance Cloud Compute
14
*
Firefox for Android
Note: This API is based on Chromium's chrome.tabs API. This documentation is derived
from tabs.json in the Chromium code.
<
54
Theme
0
Claim your
$250
Safari on iOS
>
15
*
CREDIT
Our communities
MDN Community
MDN Forum
MDN Chat
a
Log in
In this article
Syntax
Examples
Browser compatibility
WIXSTUDIO
Rapidly build,
extend, and deploy
feature-rich web
projects in a flexible
dev environment.
Mozilla ads
Don't want to see ads?
Mozilla ads
Don't want to see ads?
Developers
Don't want to see ads?
Sign up for free
MDN Plus
Mozilla ads
Hacks Blog
Web Technologies
Learn Web Development
English (US)