canvas-toBlob.js
canvas-toBlob.js copied to clipboard
ERROR SecurityError on IE 11
I am getting ERROR SecurityError on IE 11.
Please suggest any solutions.
Are you using this with a tainted canvas?
Although you can place images/other media without CORS approval in your canvas, doing so taints the canvas. Once a canvas has been tainted, you can no longer pull data back out of the canvas. For example, you can no longer use the canvas toBlob(), toDataURL(), or getImageData() methods; doing so will throw a security error.
How about when we're just converting our svg to canvas then to blob.
In what way is the canvas will be tainted?
If the SVG file contains any references to external sources (CSS, objects, images etc.) it won't work. Everything in the SVG must be inlined. Or else you will have the same situation as using external resources directly, but as they are encapsulated in a SVG the browser is more strict. So you cannot use CORS in these cases.
This is a security feature of the browser and you can't change much about it but to make sure all resources needed for the SVG are embedded. Even then there are some known unavoidable browser quirks.
There is a library called canvg that claims to be able to get around this.
Sent from my Google Pixel XL using FastHub
So does this mean, even though the files are loaded locally, or maybe even minified, the canvas will always be tainted unless we literally put the styles inline?
same issue