2

Is there a way to replicate the behavior of Firefox "screenshot node" option in the dom inspector with js?

So I could select an element and do something like:

elem = document.getElementById("something");
screenshot = elem.takeScreenshot("image/png");
//screenshot: base64 encoded image string

Maybe with the built in Firefox function ? Firefox "screenshot node" function

If not, is there a way to access it or do it from the addon-sdk ?

Kind regards, Flo.

Feirell
  • 719
  • 9
  • 26
  • Possible duplicate of http://stackoverflow.com/questions/4912092/using-html5-canvas-javascript-to-take-screenshots – mplungjan Jan 09 '16 at 10:00
  • @mplungjan ok I should have added this, I tried HTML2Canvas but like it is stated the css render support is limited, and images are only loadable with a proxy because of CORS – Feirell Jan 09 '16 at 10:13

1 Answers1

0

This can be achieved by computing the bounding box of the node and then using the privileged CanvasRenderingContext2D.drawWindow API

the8472
  • 40,999
  • 5
  • 70
  • 122