How to use html2canvas proxy

amine picture amine · Mar 22, 2012 · Viewed 20.1k times · Source

I'm using html2canvas plugin to generate snapshot of web pages. The problem is that everything runs ok in the localhost, however when deployed on the remote server I get the following error : Unable to get image data from canvas because the canvas has been tainted by cross-origin data.

I've found a plugin that is supposed to work : https://github.com/niklasvh/html2canvas-proxy

The problem is that I don't know how to use it !

Similar question is asked here but remains without answer : https://github.com/niklasvh/html2canvas/issues/61

Answer

amine picture amine · Mar 29, 2012

I've solved this issue, the proxy code needs to be added to the server side scripts. Then I needed to change the order of if statements to make calling the proxy the first choice since it will be the case for all the images we are dealing with in our project. Thanks Niklas. More details are here : https://github.com/niklasvh/html2canvas-proxy/issues/2#