1
votes

I have been trying to create a Firefox add-on using the web extensions API. My add-on should take a screenshot of the current page the user is browsing using chrome.tabs.captureVisibleTab but it returns undefined. They say that its already implemented in the API on http://arewewebextensionsyet.com/ but I can't seem to get it to work.

Here is my code:

chrome.tabs.captureVisibleTab(null, {}, function(data) {
    console.log("screenshotData: " + data); 
});

I have also tried passing in a window.id as the first parameter even though in the docs it says its optional, but this also returns an undefined value for data.

Does anyone have any experience with this in particular?

1
have you looked at the compatibility table? developer.mozilla.org/en-US/Add-ons/WebExtensions/API/Tabs/… - the8472
yea, I've been testing on Firefox nightly 49.0a1. - Michael Zhang

1 Answers

4
votes

It works for me in Nightly 49.0a1 (2016-06-04).

Make sure you have the following permission in your manifest.json file:

"permissions": [ "<all_urls>" ]