Skip to content Skip to sidebar Skip to footer

Html Detect Ie8 And Lower Or Any Other Browser

With HTML comments, I am trying to do something like the following - //if browser is IE8 or less display the following
IE8

Solution 1:

Reference

<!--[if IE 8]>
    According to the conditional comment this is IE 8<br />
<![endif]--><!--[if lt IE 9]>
    According to the conditional comment this is IE lower than 9<br />
<![endif]--><!--[if gt IE 7]>
    According to the conditional comment this is IE greater than 7<br />
<![endif]-->

For example,

<html><head><linkhref="my-styles.css"><!--[if IE 8]>
            <link  href="my-ie8-only-styles.css">
        <![endif]--></head><body><p>Hello World!</p></body></html>

Or you could use it to only render certain html markup...

....
<!--[if IE 8]>
    <div id="ie8Only">IE8 Only</div>
<![endif]-->
....

Solution 2:

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

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

Post a Comment for "Html Detect Ie8 And Lower Or Any Other Browser"