Question

My chrome extension is intended to periodically take screenshot from a web URL, and update some local disk data. I know how to do it by opening a new tab and taking the screenshot of it. But is there a way to avoid a new tab being opened, or at least open a hidden tab without annoying the user and doing all this silently?

I don't want to generate screenshots on a server, I need to do this all in the local machine.

Was it helpful?

Solution

I know that my suggestion won't answer the question literally, but as I noticed there are many questions on the web regarding taking screenshots or grabs of webpage periodically, I'll post it anyway. Others who stumble across this question might benefit from the answer.

If you are using Mac OSX and don't mind bypassing Chrome all together, one could use webkit2png.

Obtain it either from

http://www.paulhammond.org/webkit2png/http://www.paulhammond.org/webkit2png/

or use Homebrew

brew install webkit2png

and:

webkit2png http://google.com/

The Mac version of webkit2png is derived from a Linux-original, that I've not tested. I mention this because in other questions elsewere on internet and Stack Exchange, Linux was specifically mentioned.

http://khtml2png.sourceforge.net/

and / or

https://github.com/AdamN/python-webkit2png/

OTHER TIPS

I don't know, maybe you could open it in a iframe in the background page?

But html2canvas is a library that lets you do that with only JavaScript. It won't be perfect but I think that's what you're looking for.

Now I think it is more safe doing this using a NPAPI plugin which takes screenshots silently and just call its functions through my chrome extention.

In addition to my previous answer, you might want to checkout http://phantomjs.org/

A JavaScript library that can be easily installed and configured to take screenshots.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top