检测低版本浏览器提示用户升级浏览器.

已经有好几个月没有更新博客了,这几个月碰到的事情太多了,最近一个月接了一个PHP单子,等到客户用360浏览器测试的时候发现网站大部分javascript在IE浏览器下面都没法执行,导致首页的海报和产品展示页面的多级菜单都没法正常使用,真是苦恼。要是让这个站兼容老版本IE我都不知道还要写多少代码,计算机网络都发展多少年了,IE浏览器在国内占据着36%的市场,开发者在这个问题上绝对不能妥协,这里贴上我从其他网站上抄来的代码,供有需要的人作参考。
检测低版本浏览器提示用户升级浏览器. - 1

代码部分

<!--[if lte IE 8]>
<div id="ie6-warning"><p>This Website used HTML5+CSS3,Now you are using old version Internet Explorer,If you want a better experience,We recommend that you upgrade to <a href="http://www.microsoft.com/china/windows/internet-explorer/" target="_blank">New Internet Explorer</a> Or you can use the follow broswers:
    <br>
<a href="http://www.mozillaonline.com/">Firefox</a> / 
<a href="http://www.baidu.com/s?wd=google%E6%B5%8F%E8%A7%88%E5%99%A8">Chrome</a> / 
<a href="http://www.apple.com.cn/safari/">Safari</a> / 
<a href="http://www.operachina.com/">Opera</a></p></div>
<style type="text/css">
/*ie6提示*/
#ie6-warning{width:100%;background:rgb(40,40,40);color:#fff;padding:5px 0;font-size:12px}
#ie6-warning a{color:#f08826;}
#ie6-warning p{width:960px;margin:0 auto;}
  </style>
<![endif]-->

5 thoughts on “检测低版本浏览器提示用户升级浏览器.”

  1. 额 刚装好的XP一般都是IE6 打开百度就会有提示 建议升级百度浏览器 估计就是这个原理

Leave a Reply to FROYO Cancel reply

Your email address will not be published. Required fields are marked *