Targeting IE 8 and Below?

Viewed 1404

I have a script that runs great in IE 9+ and all other browsers. But in IE 8 or below there are visual errors. I can fix this visual errors by changing some animation effects for IE 8 and below. To do this I need to have two scripts on my page. One for IE 9+, Firefox, Chrome, Safari, and the other for IE 8 and below.

Here is what I have tried:

// First the Script that runs for non-IE browsers. 
<!--[if !IE]>
<script type="text/javascript">
// Script that runs
</script>
<![endif]-->

// Now for the Script for IE 8
<!--[if lt IE 9]>
<script type="text/javascript">
// Script that runs
</script>
<![endif]-->

First Question and the main one is when attempting this it doesn't seem to work. IE starts acting crazy and the script doesn't function proerply at all. If I remove the first script and leave the second one it works without issue. It would seem that the <!--[if !IE]><!--> is not working correctly.

Second Question: Using <!--[if !IE]><!--> can I target only IE 8 and below?

1 Answers
Related