Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript code to take a screenshot of a website without using ActiveX

Tags:

I have a JavaScript application that an user interacts with. I need to save the appearance of the interface at the current time, crop out the part that I need (or only shot the part that I need by specifying the div), and send it back to the server.

Clearly any external services would not be able to do this, I need a JavaScript (or Flash) script that can save the screen appearance. Is this possible?

Also, as the comment below says, I cannot use ActiveX.

like image 224
Jourkey Avatar asked Jan 12 '10 05:01

Jourkey


People also ask

Can you take a screenshot with JavaScript?

A screenshot of any element in JavaScript can be taken using the html2canvas library. This library can be downloaded from its official website.

How do I take a screenshot of a website using jQuery?

HTML & Script – Include the jQuery library. Create screenshot() function where initialize html2canvas on the body. By default, html2canvas set the image background color to black if save the screenshot. With the use of background: '#fff' set background white.

How do I take a screenshot of a HTML page?

Please click on the toolbar button (or press Alt+Shift+D combination) to capture the screenshot. You can adjust the screenshot image format from the options page.


1 Answers

Google is doing this in Google+ and a talented developer reverse engineered it and produced http://html2canvas.hertzen.com/ . To work in IE you'll need a canvas support library such as http://excanvas.sourceforge.net/

like image 198
JAAulde Avatar answered Sep 20 '22 15:09

JAAulde