ng2-canvas-whiteboard icon indicating copy to clipboard operation
ng2-canvas-whiteboard copied to clipboard

Fix for CORS images on canvas

Open Elvander opened this issue 4 years ago • 2 comments

Loading an image as background from another domain is possible, but when saving the image an error is thrown (Firefox).

ERROR DOMException: The operation is insecure.

This happens when calling the canvasToDataUrl on a canvas.

More information: https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image

Elvander avatar Sep 21 '20 11:09 Elvander

Hi, I am not sure about merging the PR, please check this issue and the comments about why Cors taints the canvas as a security feature and how to overcome it

https://github.com/webfactorymk/ng2-canvas-whiteboard/issues/8

Peshou avatar Sep 21 '20 11:09 Peshou

The problem is that sometimes that there are no efficient ways to overcome this. For example a CDN server , even on the same top domain. Loading it through a proxy to map it to a base64 would add some extra delay/bandwidth.

How about I make this a property to allow 'insecure' image loading? The default would be not to allow this, except if we enable the feature through a property?

Elvander avatar Sep 23 '20 15:09 Elvander