Take screenshot in chrome extension
If you are working on a Chrome extension and want to take a screenshot if the background webpage use the following code.
chrome.tabs.captureVisibleTab(null, {}, function (image) {
console.log(image); //the image variable is a base64 encoded image which you should be able to load in either canvas or src attribute of an image.
});Written by Suman Paul
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Chrome
Authors
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#