I want to execute a certain code in jQuery if the browser is lower than IE9. And yes, i already know about
<!--[if ... IE ]> <![endif]-->
But what i want is to check this condition within the scipt tag and with jQuery document.ready
<script>
$(document).ready(function(){
//code to check if lt ie9
});
</script>
Use feature detection instead of browser detection. i.e. http://modernizr.com/
You can target older Internet Explorer versions (<= 9) through classes on the
<html>
element...... and then check if
<html>
has the class.lt9
or.lt8
— whatever version of Internet Explorer you are targeting:However, I would suggest using Modernizr feature detection instead of checking for a specific browser.