wewntw
Last Updated: February 25, 2016
·
739
· skeep

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.
});