jQuery approach $.browser.msie is the best way to detect if you are viewing in an Internet Explorer browser. In addition, you can also add another jQuery code to detect the version of the IE browser - $.browser.version.
Detecting browser is important since there are some jQuery and other framework code that are not working proper in different browsers. In this manner, you can make conditional code depending on the user’s browser.
Using jQuery :
<script>
// less than IE 8
if ($.browser.msie && $.browser.version.substr(0,1)<8) {
//your code here
}
// less than IE 7
if ($.browser.msie && $.browser.version.substr(0,1)<7) {
//your code here
}
</script>
NOTE: Don't forget to Add jQuery library.
Using conditional comment:
<!--[if lte IE 6]>
<script type="text/javascript">
var isRunningIE6OrBelow = true;
</script>
<![endif]-->
2 comments:
It save's my life.... Thank you.
thank you , saved me a lot of time.
Post a Comment