01 June 2012

The Latest Hosted jQuery

Given the most recent version of jQuery https://code.jquery.com/jquery-latest.min.js, you can find the latest hosted versions here…

Google CDN (SSL via HTTPS is optional)

Microsoft CDN (SSL via HTTPS is optional)

jQuery CDN


Why not just use the link that’s always the latest?

You shouldn’t use the jquery-latest link in your applications because the CDNs (content delivery networks) offer better caching on the versioned urls, and your application may have unpredictable results if something changes in a newer version of jQuery.


HTTPS vs HTTP

For the CDNs with optional https, you can just reference the script in your HTML files as shown below and it will choose the protocol that matches your site. Even if your site doesn’t use SSL, you’re cutting back on a few characters and ready to go if you eventually do support https.

<script src="//ajax.googleapis.com/ajax/libs/jquery/0.0.0/jquery.min.js">
</script>

This is safe to use cross-browser.


Is this up-to-date?

Yes, it programmatically gets the version number from the jquery-latest file. The only risk is that the CDN’s haven’t updated yet to include the latest version, but if you open the link and it’s there, then you’re safe.


Download it locally!

You might want to download the latest file locally—especially if you’re developing offline. The easiest url to remember for this is https://bit.ly/jqsource. Here’s how to pull it down locally via the commandline:

wget https://bit.ly/jqsource -O jquery.js

or

curl https://bit.ly/jqsource > jquery.js


Now you only need to remember mrcoles.com/jquery ;?j

Comments (1)

1. harold wrote:

;?j

Posted on 1 June 2012 at 10:06 AM  |  permalink




Did you find this helpful or fun? paypal.me/mrcoles

Peter Coles

Peter Coles

is a software engineer living in NYC who is building Superset 💪 and also created GoFullPage 📸
more »

github · soundcloud · @lethys · rss