Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

HTML2Canvas - Take "screenshots" of webpages using JavaScript


Recommended Posts

Posted

Clever use of JavaScript to take screenshots from within your browser...

 

Website / Demo / Source Code / More Info

 

This script allows you to take "screenshots" of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot, but builds the screenshot based on the information available on the page.

 

How does it work?

The script renders the current page as a canvas image, by reading the DOM and the different styles applied to the elements. However, as many elements are displayed differently on different browsers and operating systems (such as form elements such as radio buttons or checkboxes) as well as

It does not require any rendering from the server, as the whole image is created on the clients browser. However, for browsers without canvas support alternatives such as flashcanvas or ExplorerCanvas are necessary to create the image. Additionally, to render iframe content or images situated outside of the same origin policy a proxy will be necessary to load the content to the users browser. The script is still in a very experimental state, so I don't recommend using it in a production environment nor start building applications with it yet, as there will be still major changes made. However, please do test it out and report your findings, especially if something should be working, but is displaying it incorrectly.

 

It currently still has jQuery as a dependancy, but that will get removed soon.

 

Browser compatibility

The script should work fine on the following browsers:

  • Firefox 3.5+
  • Google Chrome
  • Newer versions of Opera
  • >=IE9 (Older versions compatible with the use of flashcanvas)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...