Possible Duplicate:
how do i detect ie 8 with jquery
Hi All,
I was on here looking for a JQuery snippet to detect IE8. This is what I found, see below:
    if(jQuery.browser.version.substring(0, 2) == "8.") { 
        $('#step-1').css({'margin-left':'8px'});
     }
I found this but it doesnt seem to be working...Can someone advise me where I might be going wrong...or have other suggestions.
Thanks
var isIE8 = $.browser.msie && +$.browser.version === 8;
if ( isIE8 ) {
    // do stuff
}
                        use $.browser.msie for detecting IE and $.browser.version for getting the version
See the following SO questions:
How do I detect IE 8 with jQuery?
When IE8 is not IE8 what is $.browser.version?
Detect IE6 with Jquery  
Try and use the ninja search. http://www.stackoverflow.com/search
I set the google stackoverflow search with a keyword "so" on Google Chrome, found those questions in 3 secs ;)
Jquery has default functionality for this. You can read about it here.
For example:
<script>
    jQuery.each(jQuery.browser, function(i, val) {
      $("<div>" + i + " : <span>" + val + "</span>")
                .appendTo(document.body);
    });
</script>
Which will result in;
MSIE : true
version : 8.0
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With