教程集 www.jiaochengji.com
教程集 >  脚本编程  >  javascript  >  正文 meta X-UA-Compatible IE=EmulateIE7 什么意思

meta X-UA-Compatible IE=EmulateIE7 什么意思

发布时间:2023-10-24   编辑:jiaochengji.com
教程集为您提供meta X-UA-Compatible IE=EmulateIE7 什么意思等资源,欢迎您收藏本站,我们将为您提供最新的meta X-UA-Compatible IE=EmulateIE7 什么意思资源

目前ie8尚在测试版中,所以为了避免制作出的页面在ie8下面出现错误,建议直接将ie8使用ie7进行渲染。也就是直接在页面的header的meta标签中加入如下代码:


meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>网易</title>
<base target="_blank" />
<meta name="keywords" content="网易,邮箱,游戏,新闻,体育,娱乐,女性,亚运,论坛,短信,数码,汽车,手机,财经,科技,相册" />
<meta name="description" content="网易是中国领先的互联网技术公司,为用户提供免费邮箱、游戏、搜索引擎服务,开设新闻、娱乐、体育等30多个内容频道,及博客、视频、论坛等互动交流,网聚人的力量。" />
<meta http-equiv="x-ua-compatible" content="ie=emulateie7" />

这样我们才能使得页面在ie8里面表现正常! http-equiv="x-ua-compatible" content="ie=emulateie7" />标签!
<meta name="robots" content="index, follow" />
<meta name="googlebot" content="index, follow" />
<!--[if ie 6]><script type="text/网页特效">try { document.execcommand('backgroundimagecache', false, true); } catch(e) {}</script><![endif]-->


  那这个标签是什么意思呢?让我来看下msdn上的说明:

在ie8 beta 1中,该选项是"ie浏览器= 7的"x -尿酸兼容的标记,它指示要显示在ie7 ie8的标准模式的内容。但是,这并不解决方案是,当ie浏览器= 7是一个http头到一个站点,其中包含怪癖模式的网页应用。在ie = 7 http头将迫使所有网页 - 既有怪癖和标准 - 显示在ie7标准模式。开发人员使用这个头,同时在更新他们的网站将不得不添加"ie浏览器= 5"的标签,以每一页,他们要保留的怪癖模式。这种逻辑是罚款许多网站。但是,如果一个网站有很多网页的怪癖模式,或与框架的情况下举办的网页的内容严格和怪癖模式 - 作为揭示了ie8的beta 1的用户反馈 - 兼容性选择退出增加了一个多一点的混合工作比我们预期。


  x-ua-compatible是针对ie8新加的一个设置,对于ie8之外的浏览器是不识别的,这个区别与content="ie=7"在无论页面是否包含指令,都像是使用了 windows internet explorer 7的标准模式。而content="ie=emulateie7"模式遵循指令。对于多数网站来说,它是首选的兼容性模式。

  目前ie8尚在测试版中,所以为了避免制作出的页面在ie8下面出现错误,建议直接将ie8使用ie7进行渲染。也就是直接在页面的header的meta标签中加入如下代码:
         <meta http-equiv="x-ua-compatible" content="ie=7" />
  这样我们才能使得页面在ie8里面表现正常! http-equiv="x-ua-compatible" content="ie=emulateie7" />标签!

更详细的说明

x-ua-compatible是针对ie8新加的一个设置,对于ie8之外的浏览器是不识别的,这个区别与content="ie=7"在无论页面是否包含<!doctype>指令,都像是使用了 windows internet explorer 7的标准模式。而content="ie=emulateie7"模式遵循<!doctype>指令。对于多数网站来说,它是首选的兼容性模式。

目前ie8尚在测试版中,所以为了避免制作出的页面在ie8下面出现错误,建议直接将ie8使用ie7进行渲染。也就是直接在页面的header的meta标签中加入如下代码:

<meta http-equiv="x-ua-compatible" content="ie=7" />这样我们才能使得页面在ie8里面表现正常!

 

 

浏览器市场份额的激烈竞争,给网页设计开发人员带来了兼容性设计的麻烦。单单 ie 浏览器就有好几个主流版本,ie6、ie7、ie8 等等。当然使用诸如 ietester,多版本 ie 共存解决方案之类的第三方集成工具,可以方便代码调试。但我们总需要找寻一种更为省时省力的方法。

x-ua-compatible 是针对 ie8 版本的一个特殊文件头标记,用于为 ie8 指定不同的页面渲染模式。由于当下 ie6 和 ie7 使用率依然较高,综合考虑,启用 ie8 版本的 x-ua-compatible 兼容模式显得相当重要。

各种兼容模式代码示例如下:

<meta http-equiv="x-ua-compatible" content="ie=5" />像是使用了 windows internet explorer 7 的 quirks 模式,这与 windows internet explorer 5 显示内容的方式很相似。

<meta http-equiv="x-ua-compatible" content="ie=7" />无论页面是否包含 <!doctype> 指令,均使用 windows internet explorer 7 的标准渲染模式。

<meta http-equiv="x-ua-compatible" content="ie=8" />开启 ie8 的标准渲染模式,但由于本身 x-ua-compatible 文件头仅支持 ie8 以上版本,因此等同于冗余代码。

<meta http-equiv="x-ua-compatible" content="edge" />edge 模式通知 windows internet explorer 以最高级别的可用模式显示内容,这实际上破坏了"锁定"模式。

<meta http-equiv="x-ua-compatible" content="ie=emulateie7" />emulateie7 模式通知 windows internet explorer 使用 <!doctype> 指令确定如何呈现内容。标准模式指令以windows internet explorer 7 标准模式显示,而 quirks 模式指令以 ie5 模式显示。与 ie7 模式不同,emulateie7 模式遵循 <!doctype> 指令。对于多数网站来说,它是首选的兼容性模式。

在现阶段,ie8 版本推向市场没有多久,份额不高。因此,考虑兼容旧版本的模式值得推荐。

我们还要可通知用html现实例

<!doctype html public "-//w3c//dtd html 4.01 strict//en">
<html>
      <head>
         <title>测试页</title>
         <meta http-equiv="x-ua-compatible" content="ie=8"/>
         <!--[if gte ie 8]>
         <style type="text/css教程">
         body {
          color:#0000ff;
          background-color:#000000;
         }
         </style>
         <![endif]-->
         <!--[if lt ie 8]>
         <style type="text/css">
         body {
          color:#000000;
          background-color:#ffffff;
         }
         </style>
         <![endif]-->
      </head>
      <body>
         <h1>
         <!--[if gte ie 8]>
         第 1 章。
         <![endif]-->
         第一章
         </h1>
         <h1>
         <!--[if gte ie 8]>
         第 2 章。
         <![endif]-->
         第二章
         </h1>
         将看到任何版本的文本。
      </body

您可能感兴趣的文章:

[关闭]
~ ~