An alternative is to use the <object>
tag in your html :-
<object type="image/svg+xml" data="https://stackoverflow.com/questions/12583879/pic.svg" width="100" height="100"></object>
It’s a BIG shame the <img>
tag won’t work. I don’t want to mess about hacking with converting the SVG to a data URI. It’s to do with cross-site vulnerabilities on indirectly loading resources and the use of an “Open Redirector”.
Note that in my testing lastnight, the <img>
tag method DOES work in IE10, but neither Chrome nor FireFox.
I don’t know why <object>
is allowed and <img>
isn’t. An oversight?