Is there a link to the "latest" jQuery library on Google APIs?
I use the following for a jQuery link in my
Is there a link to the "latest" version? Something like the following (which doesn't work):
(Obviously not necessarily a great plan to link your code to potentially changing libraries but useful in development.)
Up until jQuery 1.11.1, you could use the following URLs to get the latest version of jQuery:
- https://code.jquery.com/jquery-latest.min.js - jQuery hosted (minified)
- https://code.jquery.com/jquery-latest.js - jQuery hosted (uncompressed)
- https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js - Google hosted (minified)
- https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js - Google hosted (uncompressed)
However, since jQuery 1.11.1, both jQuery and Google stopped updating these URL's; they will forever be fixed at 1.11.1. There is no supported alternative URL to use. For an explanation of why this is the case, see this blog post; Don't use jquery-latest.js.
Both hosts support
https as well as
http, so change the protocol as you see fit (or use a protocol relative URI)
Read more... Read less...
Be aware that caching headers are different when you use "direct" vs. "latest" link from google.
Cache-Control: public, max-age=31536000
Cache-Control: public, max-age=3600, must-revalidate, proxy-revalidate
Don’t Use jquery-latest.js
This file is no longer updated (it'll be on v1.11.1 forever). Furthermore it has a very short cache life, (wiping out the benefits of using a CDN) so you'd be better of selecting a version of jQuery instead.
More details on the jQuery blog: http://blog.jquery.com/2014/07/03/dont-use-jquery-latest-js/
Not for nothing, but you shouldn't just automatically use the latest library. If they release the newest library tomorrow and it breaks some of your scripts, you are SOL, but if you use the library you used to develop the scripts, you will ensure they will work.
Note: The above snippet will stick to 1.7.1 or 1.11.1.
My advice for production is to hard code the CDN jQuery version:
You can find the latest Libraries of Google CDN here: https://developers.google.com/speed/libraries/
Or use the jQuery CDN: https://code.jquery.com/