我正在编写一个简单的 HTML 文件。我想在其中嵌入一个 XML。我使用 iFrame 执行此操作。在 IE9 中,XML 被格式化(尽管它显示了 activeX 警告)。如果我在 IE10 中运行相同的代码,我根本看不到格式。我只看到 XML 内容。但是,如果我单独打开 XML,我可以看到格式。
如何在 iframe 中获取 IE10 中的格式?提前致谢。
这是我的 HTML 代码
<html>
<head>
<title>Test Code</title>
</head>
<body>
<iframe src="sample.xml"></iframe>
</body>
</html>
我的 sample.xml 是
<?xml version="1.0" encoding="utf-8" ?>
<test>asd</test>
-- 更新:将浏览器切换到 IE8 标准模式有效。
<meta http-equiv="X-UA-Compatible" content="IE=8" />
这是唯一的解决方案还是有基于 IE10 的更好的解决方案?