IE8出来以后造成很多网站出现不兼容的现象。特别是flash常常出现错误显示不全的现象。下面我给大家介绍两种非常简单的方法来解决这个IE8不兼容的问题。只需要添加几行代码就行非常的方便。
方法如下:
一、在页面中加入如下 HTTP meta-tag
程序代码
<meta http-equiv=”X-UA-Compatible” content=”IE=EmulateIE7″ />
只要IE8一读到这个标签,它就会自动启动IE7兼容模式,保证页面完整展示。
二、针对整个网站的,在IIS中加入如下描述符就可以有相同的效果,当然这么做范围更广。
程序代码
<?xml version=”1.0″ encoding=”utf-8″?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name=”X-UA-Compatible” value=”IE=EmulateIE7″>
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name=”X-UA-Compatible” value=”IE=EmulateIE7″>
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
对于所有页面都调用相同头部的网站用第一种方法也是非常方便的。wordpress网站只需要在header.php里添加
<meta http-equiv=”X-UA-Compatible” content=”IE=EmulateIE7″ />
就行了。zblog网站就需要在各个模板页去添加。
相关阅读: