【问题标题】:IE9 - Quirks Mode in main page and "Internet Explorer 9 Standards" in specific iframeIE9 - 主页中的怪癖模式和特定 iframe 中的“Internet Explorer 9 标准”
【发布时间】:2015-08-01 11:07:28
【问题描述】:

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

另外,为了完整起见:

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

我试过了

<!DOCTYPE html> 

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

在 iframe 中,但它不起作用。

【问题讨论】:

    标签: internet-explorer iframe internet-explorer-9 quirks-mode x-ua-compatible


    【解决方案1】:

    在链接到&lt;iframe src="..."&gt;&lt;/iframe&gt; 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 中时,默认情况下不会自动生成树视图。但是,当浏览器在 Compatibility View 中运行时,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>
    

    参考文献

    【讨论】:

      猜你喜欢
      • 2011-08-11
      • 1970-01-01
      • 2012-07-21
      • 2014-07-16
      • 2023-04-07
      • 2012-07-09
      • 2011-07-30
      • 2012-06-14
      • 1970-01-01
      相关资源
      最近更新 更多