Reputation: 14399
I am starting a new project and sadly I have to support IE7 & IE9. Eventually I will be able to remove IE7 support but would like a smooth way of removing it.
Essentially, where possible I want to be using the latest versions of libraries.
<!--[if lt IE 9]>
<script src="https://raw.githubusercontent.com/aFarkas/html5shiv/master/dist/html5shiv.min.js"></script>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<![endif]-->
<!--[if gte IE 9]>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<![endif]-->
<!--[if !IE]><!-->
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<!--<![endif]-->
<!--[if lt IE 8]>
<script src="http://cdnjs.cloudflare.com/ajax/libs/json3/3.3.1/json3.min.js"></script>
<![endif]-->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js"></script>
<!--[if lt IE 9]>
<script src="local/angularjs-attribute-polyfill.js"></script>
<![endif]-->
As you can see, I have the JQuery library there twice, once of gte IE9 and once for not equal to IE for the other browsers...is there a nice way to consolidate these?
Upvotes: 0
Views: 1239
Reputation: 324750
You can use
<!--[if gte IE 9]><!-->
<script src="...jquery-2.1.1.min.js"></script>
<!--<![endif]-->
This conditional comment will allow the script to be included if using IE9 or higher... and non-IE browsers will ignore the comment anyway and just include the script, no questions asked.
Upvotes: 1