Is it possible to take screenshots from Firefox for Android extension?

158 views Asked by At

I wonder if there is a native api for taking screenshots from extensions. I was reading in MDN but coudn't find anything (but maybe I didn't had the right keywords). And I'm reading about using canvas to "imitate" the visual elements of DOM and getting the dataUrl, but it will be better if there is something easier, faster, and making more similar results.

Any suggestion is welcome! Thaks in advance!

1

There are 1 answers

0
Noitidart On BEST ANSWER

Ok this is how to take a native screenshot on android. Make sure you have a 2nd tab open, it will append the canvas to it.

It has 2 problems right now, it takes 30seconds to do the math, and the math is intensive so sometimes it crashes.

Second problem is it's not getting the root view, it seems to just take a screenshot of the firefox browser layer view, not even when keyboard or main menu is open is it showing. I need it to get root view so it gets keyboard, table menubar etc etc. So working on that.

But here's the code, can copy paste it to scratchpad and run, wait 30sec, then look in your 2nd tab, there will be a canvas appended to the document.

https://gist.github.com/Noitidart/cb6e7c3a102784d04262