user2364265
user2364265

Reputation: 79

Taking screenshots on Firefox and Safari (using their APIs or Canvas code)

I've been dealing with taking screenshots for Firefox and Safari browsers but I can't figure out how to do it! With Google Chrome API I can do it this way (it's pretty simple):

chrome.tabs.captureVisibleTab(null, null, function (image)).....etc

BUT I can't find a SIMPLE way to do it on Firefox and Safari!! The only answer I got here was using the 'html2canvas' (http://html2canvas.hertzen.com/examples.html) BUT IT IS NOT a 100% solution in order to take EXACT screenshots of a specific webpage!! It doesn't work for me in this case!!! Can someone help me with this issue in order to find a simple solution for Firefox and Safari?

Upvotes: 3

Views: 1687

Answers (2)

Faizan
Faizan

Reputation: 1898

I have personally used html2canvas and I found it quite efficient for taking partial or full page screenshots. But it does require you some knowledge of JavaScript and client side scripting.

If you are looking for a more easier approach , there are numerous extensions on Google Chrome webstore. A popular one is Awesome Screenshot which even allows you to take screenshot of entire webpage (till the scroll bar ends).

Upvotes: 1

Nick
Nick

Reputation: 5198

You can use Mozilla's chrome tools to draw some or all of the window to an image canvas:

var c2d = myCanvas.getContext('2d');
c2d.drawWindow(window, x, y, w, h, 'rgb(255,255,255)');

See drawWindow(), XUL.

I don't remember exactly, but that's the gist. The magic is the .drawWindow() method, which cannot be executed on the content side, it must be in an area with chrome privileges (like an add-on/extension).

Edit: Here's a good example.

Upvotes: 1

Related Questions