I know that I can set a svg file as the src
of an HTML img
element like this:
but can
This updates the accepted answer from Phrogz (8 years after it!)
The sample does not work on Chrome or Firefox (the image appears broken) changing to
img.src = "data:image/svg+xml;base64,"+btoa(xml);
I am not sure of the reason why the original stopped working but this may help someone landing here.