JavaScript: toDataUrl() throwing "Security Error: Tainted canvases may not be exported."
I solved this by converting the svg to a data URL instead of a Blob.
I removed var url = DOMURL.createObjectURL(svg);
and replaced img.src = url;
with this:
function buildSvgImageUrl(svg) {
b64 = window.btoa(svg);
return "data:image/svg+xml;base64," + b64;
}
img.src = buildSvgImageUrl(data);
Now it works flawlessly.