Skip to content

Loading two versions of jQuery to support IE6-8 and modern browsers

G26th September 2013

CNo Comments

Tbrowser, JavaScript, jQuery

Instructions for implementing jQuery 1.x and 2.x to provide continued support for IE6, 7 and 8 whilst enjoying the benefits of jQuery 2.0 for all modern browsers.

Back in April 2013, a new version of the jQuery JavaScript library (jQuery 2.0) was released.

jQuery 2.x offers several advantages over jQuery 1.x in that the code is smaller and there is some added functionality, but the downside is that jQuery 2.x doesn’t support Internet Explorer versions 6, 7 and 8.

To account for this and to ensure continued functionality on websites that need to support those older browsers, jQuery 1.10 is available. The jQuery team will keep both branches in development until a time when support for IE8 is no longer required. Scripts that rely upon jQuery 1.x should also work with jQuery 2.0.

Until the day that support for IE8 is no longer required, best practice is to implement both jQuery 1.10 and jQuery 2.x on websites in development. To do this, conditional comments are required:

<!--[if lt IE 9]>
    <script src="/path/to/jquery-1.10.x.js"></script>  
<![endif]-->  
<!--[if gte IE 9]><!-->  
    <script src="/path/to/jquery-2.0.x.js"></script>  
<!--<![endif]-->

If it has been some time since the version of jQuery on your website has been updated, you may want to run jQuery Migrate.

   

Comments:

No comments have yet been submitted. Be the first!

Have your say:

The following HTML is permitted:
<a href="" title=""> <b> <blockquote cite=""> <code> <em> <i> <q cite=""> <strike> <strong>

Comments will be published subject to the Editorial Policy.