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

Security errors when attempting to save a captured canvas as a PNG file in Edge browser #169

Open
chrisfoote opened this issue Dec 1, 2016 · 3 comments

Comments

@chrisfoote
Copy link

I have an example on JSFiddle https://jsfiddle.net/1erhqu15/ that captures the document, crops it and then saves it as a PNG file. This works fine in Chrome & Firefox, but in Microsoft Edge I get a 'Security Error' thrown when getImageData() is called on the context of the canvas. Similarly, getImageData() throws a 'The operation is insecure' error when run on Safari V10.

Any thoughts on what could be causing the error?

Thanks,
Chris

@cburgmer
Copy link
Owner

cburgmer commented Dec 2, 2016

Hey, all browser's are taking precautions not to leak any information from the user's browsing context from the interpreted HTML. Firefox and Chrome handle this well, WebKit throws a hard error when reading from the canvas. I haven't looked into Edge much, so I can't tell for sure, but I'm assuming that this is a similar issue.

If you are interested in finding out more, you could go step by step, by

  1. start reading back from an empty canvas, then
  2. painting a simple SVG to the canvas then reading back,
  3. rendering a SVG with an empty , reading back, and finally
  4. rendering simple HTML in that tag, reading back.

Then let's see how that goes.

@chrisfoote
Copy link
Author

Thanks for the response!

I've tried painting a simple SVG by calling fillRect() on the canvas. Calling getImageData() on the canvas works in Microsoft Edge.

Sorry, I'm not 100% sure what you mean by 'rendering a SVG with an empty' - could you clarify?

@cburgmer
Copy link
Owner

cburgmer commented Dec 2, 2016 via email

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

2 participants