javascript - Resource interpreted as Document but transferred with MIME type imagesvg+xml: - Stack Overflow

When I have an SVG picture with JavaScript chrome says 'Resource interpreted as Document but trans

When I have an SVG picture with JavaScript chrome says 'Resource interpreted as Document but transferred with MIME type image/svg+xml'. I can include it with iframe or embed TAG same result. But when I change the mime type to something different the browser cannot render it. So i guess "image/svg+xml" is correct?

SVG

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg version="1.1" baseProfile="full" id="draw" 
xmlns="" xmlns:xlink=""
viewBox="0 0 480 480"> 
<defs>
<style type="text/css">
<![CDATA[
]]>
</style>
</defs>
<rect x="0" y="0" width="480" height="480" rx="0" ry="0" fill="rgb(255, 255, 255)" />

</g>
<script type="text/ecmascript"><![CDATA[
(function () { 

//Some code here

}());
]]>
</script>
</svg>

When I have an SVG picture with JavaScript chrome says 'Resource interpreted as Document but transferred with MIME type image/svg+xml'. I can include it with iframe or embed TAG same result. But when I change the mime type to something different the browser cannot render it. So i guess "image/svg+xml" is correct?

SVG

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg version="1.1" baseProfile="full" id="draw" 
xmlns="http://www.w3/2000/svg" xmlns:xlink="http://www.w3/1999/xlink"
viewBox="0 0 480 480"> 
<defs>
<style type="text/css">
<![CDATA[
]]>
</style>
</defs>
<rect x="0" y="0" width="480" height="480" rx="0" ry="0" fill="rgb(255, 255, 255)" />

</g>
<script type="text/ecmascript"><![CDATA[
(function () { 

//Some code here

}());
]]>
</script>
</svg>
Share Improve this question asked Apr 19, 2013 at 12:43 MatthiasMatthias 1,4364 gold badges28 silver badges60 bronze badges 5
  • 1 How do you "change the mime type"? – MaxArt Commented Apr 19, 2013 at 12:55
  • The server responds for SVGz with: Content-Type: image / svg + xml Content-Encoding: gzip – Matthias Commented Apr 19, 2013 at 13:02
  • I was using embed tag previously (now iframe) then I tried it also with type="image/svg+xml" for the embed tag – Matthias Commented Apr 19, 2013 at 13:03
  • Excuse me again, but is the SVG is displayed anyway what is the problem? – MaxArt Commented Apr 19, 2013 at 13:08
  • 2 The console message in chrome. It is not a real problem. But other developers inspecting your code will always be curious if there could be an issue. – Matthias Commented Apr 19, 2013 at 13:13
Add a ment  | 

2 Answers 2

Reset to default 7

Yes, image/svg+xml is the correct internet media type for SVG content, see IANA.

I had this problem for a long time but it appears application/svg-xml is the correct mime.

Refer to this https://github./w3c/svgwg/issues/266 for more details. The mime/svg-xml may be vulnerable too.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745142075a4613475.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信