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

Add crossOrigin attribute to <img /> element used to load images #13

Closed
wants to merge 1 commit into from

Conversation

jeremywiebe
Copy link

Summary:

Modern browsers track where images are loaded from and will "taint" canvases that load image data from images not loaded with proper CORS headers. Once a canvas is tainted, it cannot export its image data. Period.

This PR adds the needed image attribute so that, if the image is served with an appropriate CORS header, loading said image into a canvas won't taint it.

See Khan/live-editor#752

Test plan:

Point the live-editor project to this commit and try to use getImage("avatars/mr-pants-orange") and then take a screenshot of the canvas.

@jeremywiebe jeremywiebe self-assigned this Feb 25, 2022
@jeremywiebe
Copy link
Author

It turns out this isn't needed.

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

Successfully merging this pull request may close these issues.

1 participant