-
Notifications
You must be signed in to change notification settings - Fork 4.9k
capturing images and canvas with loaded images from other origin #103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If you use a proxy, the images should load fine assuming you are sending them base64/jsonp or with CORS headers. Are you using SVG images by any chance? Any sort of SVG image, even inline ones, taint the canvas with webkit/FF prior to version 12. |
If I can undersetand you correctly, you are drawing tainted images to the canvas (http://html2canvas.hertzen.com/tests/image.jpg, it isn't in same origin as your page, unless you are running the page under http://html2canvas.hertzen.com). If you use just dog.jpg, no proxy will be used as it doesn't need one. With http://html2canvas.hertzen.com/tests/image.jpg a proxy would be used, assuming its html2canvas handling the image loading and drawing, but from the look of things you are manually attempting to draw images onto the canvas, tainting it yourself. |
Hi Niklas, your comment made me realize that any images from different On Mon, Jun 4, 2012 at 4:34 PM, Niklas von Hertzen <
|
Within html2canvas, the proxy is for that very purpose, to allow cross-origin images to be drawn. However, if you manually draw images, you'll need to load them manually with a proxy as well then. |
Thanks Nicklas. Now, I get the clear picture to solve this prob ;) Thanks, On Thu, Jun 7, 2012 at 6:22 PM, Niklas von Hertzen <
|
Same issue with any inline SVGs: background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj...) Good news is that if you're using SVG gradients for IE9 support, then you can simply change order of your background statements, making the svg first, then listing all native linear-gradient statements. That way, FF and Chrome will recognize them and won't throw any security errors. |
If the canvas contains both remote images and local blobs, the proxy option does not work correctly. |
Hi @niklasvh Here is my code.
});
|
I tried to render a html with images in filesystem, and found "html2canvas: Finished loading 0 images" in the logs. |
is there any update over this ? |
Hi Niklas,
Thank you so much for such wonderful code. It is such a great tool to solve my scenario. It worked fine in the beginning during local testing, but I encountered some issues while trying to deploy to our development server. The issues are:
Have been searching for the solution for Issue 2 online for days but to no avail.
Hopefully you can enlighten me with a solution for this.
Thanks a lot.
The text was updated successfully, but these errors were encountered: