Html检测IE8和更低或任何其他浏览器 [英] Html detect IE8 and lower or any other browser

查看:144
本文介绍了Html检测IE8和更低或任何其他浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用HTML注释,我试图做以下事情 -

 <! -  [if lte IE 8]  - > //如果浏览器为IE8或更低版本,则显示以下
< div> IE8< / div>
<! - [endif] - >

<! - - [如果有其他BROSWER] - > //任何其他浏览器都这样做
< div>任何其他浏览器< / div>
<! - [endif] - >

我似乎无法找到有效的组合。如何做到这一点?

解决方案

我知道这是一个老问题,但这里是我的解决方案。 b

 <! -  [if lt IE 9]><! - > 
< script src =〜/ Scripts / jquery-1.10.2.min.js>< / script>
< script src =〜/ Scripts / html5shiv.js>< / script>
<! - <![endif] - >
<! - [if(gte IE 9)| (!IE)] GT;<! - >
< script src =〜/ Scripts / jquery-2.1.4.min.js>< / script>
<! - <![endif] - >


With HTML comments, I am trying to do something like the following -

<!-- [if lte IE 8] -->  //if browser is IE8 or less display the following
    <div>IE8</div>    
<!-- [endif] -->

<!-- [if ANY OTHER BROSWER] -->  //any other browser do this
    <div>Any other browser</div>   
<!-- [endif] -->

I can't seem to find a combination that works? How can this be done?

解决方案

I know it's a bit old question, but here's my solution

    <!--[if lt IE 9]><!-->
        <script src="~/Scripts/jquery-1.10.2.min.js"></script>
        <script src="~/Scripts/html5shiv.js"></script>
    <!--<![endif]-->
    <!--[if (gte IE 9) | (!IE)]><!-->
    <script src="~/Scripts/jquery-2.1.4.min.js"></script>
    <!--<![endif]-->

这篇关于Html检测IE8和更低或任何其他浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆