簡體   English   中英

資源被解釋為文檔,但以MIME類型image / svg + xml傳輸:

[英]Resource interpreted as Document but transferred with MIME type image/svg+xml:

當我有一個帶有JavaScript chrome的SVG圖片時,說“資源被解釋為文檔,但以MIME類型image / svg + xml傳輸”。 我可以將其包含在iframe中,也可以嵌入TAG相同的結果。 但是,當我將mime類型更改為其他類型時,瀏覽器無法呈現它。 所以我猜“ image / svg + xml”是正確的嗎?

SVG

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg version="1.1" baseProfile="full" id="draw" 
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/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>

是的, image/svg+xml是SVG內容的正確互聯網媒體類型,請參閱IANA

我這個問題已經很長時間了,但是看來application / svg-xml是正確的mime。

有關更多詳細信息,請參閱此https://github.com/w3c/svgwg/issues/266 mime / svg-xml也可能容易受到攻擊。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM