3

我们有一个旧网站,它在我们所有的 IE9 客户端上以 Quirks 模式运行:

在此处输入图像描述

另外,为了完整起见:

在此处输入图像描述

该网站由许多 iframe 组成,并且出现了一个新要求:
我需要创建一个新 iFrame,其中将使用 bootstrap,并且我需要在Internet Explorer 9 标准中渲染此框架的内容(即禁用 Quirks 模式仅在此 iframe 中并照常渲染)。

我试过把

<!DOCTYPE html> 

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

在 iframe 内部,但它不起作用。

4

1 回答 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>

参考

于 2016-02-19T16:52:12.580 回答