Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在IE9中,SVG不会在iframe内部呈现_Iframe_Svg_Internet Explorer 9 - Fatal编程技术网

在IE9中,SVG不会在iframe内部呈现

在IE9中,SVG不会在iframe内部呈现,iframe,svg,internet-explorer-9,Iframe,Svg,Internet Explorer 9,我正在使用svg创建可视化,它在IE9中呈现得很好。我正在开发一种功能,用户可以将可视化嵌入到他们的页面中。我是通过iframe来做这件事的。我在IE9的iframe中遇到了SVG无法渲染的问题 下面是一个简短的示例,它适用于大多数浏览器,但在IE9中显示为blank <html><body> <iframe width="640" height="480" src="http://www.croczilla.com/bits_and_p

我正在使用svg创建可视化,它在IE9中呈现得很好。我正在开发一种功能,用户可以将可视化嵌入到他们的页面中。我是通过iframe来做这件事的。我在IE9的iframe中遇到了SVG无法渲染的问题

下面是一个简短的示例,它适用于大多数浏览器,但在IE9中显示为blank

    <html><body>
    <iframe width="640" height="480"       src="http://www.croczilla.com/bits_and_pieces/svg/samples/butterfly/butterfly.svg"/>
    </body></html>

有什么想法吗?谢谢。

IE9需要一个

 <!DOCTYPE html> 

声明在开始时以标准模式呈现文档,否则它将退回到怪癖模式

现在我们可以把它放在上面我给出的例子的顶部,使之:

 <!DOCTYPE html>
 <html><body>
<iframe width="640" height="480"       src="http://www.croczilla.com/bits_and_pieces/svg/samples/butterfly/butterfly.svg"/>
</body></html>

但是,由于用户将iframe嵌入到他们的页面中,显然不能依赖于他们的页面总是定义doctype。因此,更好的解决方案是在iframe中添加“”。 此外,我想指出,多个doctype不会影响页面呈现,因为在iframe中定义的doctype只适用于iframe


我希望IE9能像其他浏览器一样在页面中检测到这些特性,并在将来正确呈现

“那个例子对我很有用吗?”邓克:请参考我的答案。可能是IE9正在标准模式下呈现页面。你真幸运。:)