Skip to content
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

SVGs not loaded via proxy, causing tainted canvas #803

Closed
Paratron opened this issue Feb 19, 2016 · 2 comments
Closed

SVGs not loaded via proxy, causing tainted canvas #803

Paratron opened this issue Feb 19, 2016 · 2 comments

Comments

@Paratron
Copy link

Hi,
I had the issue that html2canvas would not use the given proxy script to fetch SVG images. I don't know why it was built this way, but the code in imageloader.js would never allow an SVG to be fetched by the proxy.

This causes the canvas to be tainted - even when allowTaint was set to false. I updated the method to only load SVGs directly, when no proxy script has been defined.

I already created pull request #802 if you want to pull the fix into the project.

@ocke
Copy link

ocke commented May 19, 2016

I ran into the same problem! I have a svg file in a new browser.

This line: https://github.com/niklasvh/html2canvas/blob/master/src/imageloader.js#L63
if (this.isSVG(src) && !this.support.svg && !this.options.allowTaint) {
is falsy because of this.support.svg. Which is fine.
However, this line:
} else if (this.isSameOrigin(src) || this.options.allowTaint === true || this.isSVG(src)) {
then is true, and loads our svg with cors set to false which per definition taints the canvas :|.

Questions:

  • I assume SVGContainer is for browser that don't support SVG?
  • Why load an SVG with cors false?

@niklasvh
Copy link
Owner

Fixed in 50608e9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants