Best way to handle external older version of jQuery


I’m just making a start on a new design for my site. What I would like to do, is load jQuery based on the browser the person is using. For example, I want to use the latest version of jQuery 2.2.4 for browsers that can cope with it, and then 2.2.4 + migrate for those who can’t make use of jQuery 2.2.x (such as IE 6 7 and 8).

Is there a best practice for this? I’ve found conflicting information online.



You can use conditional comments for this.

Though this may be overcomplicating things.

1 Like

Thanks Sam - that could do it! The main reason I want to upgrade, is that jquery 3.1.1 is much nicer and smaller (85kb), verses 1.12.4 being 95kb. Also we don’t want to be using archaiac libraries, just to support the few people who are too lazy to upgrade to a newer version of IE =)

I assume the conditionals can be used in the footer of the page, and not just the header? (we load our jQuery in the footer, so not to slow the page down too much)



I believe they can be used anywhere within the html.

Cool, thanks. Will give that a go!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.