Make IE7 compatible using CSS conditional comment

70 views Asked by At

I've been struggling to make my website IE7 Compatible. I'm using this code is my head tag to ensure that if the website is running on IE7 it should use jquery 1.7 instead of jquery 2.1.

 <!--[if IE 7]>
  <script src="../../common/js/jquery-1.7.1.min.js" type="text/javascript"></script>
<![endif]-->

<!--[if lt IE 9]>
 <script src="../../common/js/jquery-2.1.1.min.js"></script>
<![endif]-->

But I'm still getting error like this : enter image description here

Which means that the website is still using Jquery-2.1.1, but I'm testing it on IE7.

What's wrong with this code?

1

There are 1 answers

2
Praveen Kumar Purushothaman On BEST ANSWER

Your second one does it! So load it first!

<!--[if lt IE 9]>
  <script src="../../common/js/jquery-2.1.1.min.js"></script>
<![endif]-->
<!--[if IE 7]>
  <script src="../../common/js/jquery-1.7.1.min.js" type="text/javascript"></script>
<![endif]-->

Or make the 2.1.1, greater than IE 7!

<!--[if gt IE 7]>
  <script src="../../common/js/jquery-2.1.1.min.js"></script>
<![endif]-->