In order to display an SVG image file onto a canvas I have the following line on the HTML:
<img id="soundOnImg" src="img/speaker_on.svg" style="display:none"></img>
and then to draw it on the canvas I do:
ctx2d.drawImage($("#soundOnImg")[0], 10, 10, 200, 200);
(using jQuery $()
there)
This works perfectly except for one annoyance - Chrome gives me the following warning:
Resource interpreted as image but transferred with MIME type image/svg+xml.
What does this warning mean?
I tried using <object>
instead of <img>
but this fails since the object element doesn't seem to have a [0]
for some reason.
How can I fix this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…