IE9主页处于“怪异模式”,指定的iframe中为“Internet Explorer 9标准”

3
我们有一个遗留网站,所有客户端都在IE9的Quirks模式下运行:

enter image description here

此外,为了完整起见:

enter image description here

该网站由许多iframe组成,现在出现了一个新要求:我需要创建一个新的iFrame,在其中使用bootstrap,并需要在Internet Explorer 9标准下呈现此框架的内容(即仅在此iframe中禁用Quirks Mode并像往常一样呈现)。

我试过将

<!DOCTYPE html> 

<meta http-equiv="X-UA-Compatible" content="IE=9">  

在 iframe 中,但它没有起作用。
1个回答

0

在与<iframe src="..."></iframe> URL相关的标记中,使用带有XML声明的HTML5文档类型:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="https://www.facebook.com/2008/fbml" xml:lang="en">
<!--...-->
</html>

因此,当XML内容嵌入到IFRAME中时,默认情况下不会自动生成树视图。然而,在浏览器运行在兼容视图下时,IE会尝试更接近以前版本的行为,这就是为什么在这些情况下树视图仍然显示出来。

或者使用XSLT:

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="html5.xml"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns="http://www.w3.org/1999/xhtml"
                >
<xsl:output method="xml" encoding="utf-8" version="" indent="yes" standalone="no" media-type="text/html" omit-xml-declaration="no" doctype-system="about:legacy-compat" />

<xsl:template match="xsl:stylesheet">
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="/">
  <html>
    <head>
      <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    </head>
    <body>
      These<br/>words<br/>are<br/>seperated<br/>by<br/>BRs
    </body>
  </html>
</xsl:template>

</xsl:stylesheet>

参考资料


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接