• 强制将IE,Chrome设置为指定兼容模式来解析


    一.指定文件兼容性模式

    要为你的网页指定文件模式,需要在你的网页中使用meta元素放入X-UA-Compatible http-equiv 标头。

    1. 强制IE8使用IE8模式来解析,而且那个兼容性视图 按钮也被去掉了

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

    2. Google Chrome Frame也可以让IE用上Chrome的引擎:

    <meta http-equiv="X-UA-Compatible" content="chrome=1" />

    3.强制IE8使用IE7模式来解析

    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"><!-- IE7 mode --> 或者

    <meta http-equiv="X-UA-Compatible" content="IE=7"><!-- IE7 mode -->

    4.强制IE8使用IE6或IE5模式来解析

    <meta http-equiv="X-UA-Compatible" content="IE=6"><!-- IE6 mode -->

    <meta http-equiv="X-UA-Compatible" content="IE=5"><!-- IE5 mode -->

    5.如果一个特定版本的IE支持所要求的兼容性模式多于一种,如:

    <meta http-equiv="X-UA-Compatible" content="IE=5; IE=8" />

    二.设定网站服务器以指定预设兼容性模式

         网站管理员可籍着为网站定义一个自订标头来为他们的网站预设一个特定的文件兼容性模式。这个特定的方法取决于你的网站服务器。举例来说,下列的 web.config文件使Microsoft Internet Information Services (IIS)能定义一个自订标头以自动使用IE7 mode来编译所有网页。

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    <system.webServer>
    <httpProtocol>
    <customHeaders>
    <clear />
    <add name="X-UA-Compatible" value="IE=EmulateIE7" />
    </customHeaders>
    </httpProtocol>
    </system.webServer>
    </configuration>

           若你已于网站服务器指定了一个预设的文件兼容性模式,你可以在个别页面上指定不同的文件兼容性模式来盖过它。在网页中指定的模式优先权高于服务器中所指定的模式。

    原文:http://www.cnblogs.com/yoyiorlee/archive/2010/10/10/1846994.html

  • 相关阅读:
    mysql(一)
    spring
    数据库连接池
    spring jdbctemplate
    HDU-4219-Randomization?
    离线赛总结
    HDU-4507-吉哥系列故事-恨7不成妻
    HDU-1204-糖果大战
    [BZOJ1150][CTSC2007]数据备份
    二分图学习笔记
  • 原文地址:https://www.cnblogs.com/HeroBeast/p/1847177.html
Copyright © 2020-2023  润新知