Is There a Link to the "Latest" Jquery Library on Google APIs

Is there a link to the latest jQuery library on Google APIs?

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)

For example:

<script src="https://code.jquery.com/jquery-latest.min.js"></script>

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)

See also: https://developers.google.com/speed/libraries/devguide

Latest jQuery version on Google's CDN

UPDATE 7/3/2014: As of now, jquery-latest.js is no longer being updated.
From the jQuery blog:

We know that http://code.jquery.com/jquery-latest.js is abused
because of the CDN statistics
showing it’s the most popular file. That wouldn’t be the case if it
was only being used by developers to make a local copy.

We have decided to stop
updating this file, as well as the minified copy, keeping both files
at version 1.11.1 forever.

The Google CDN team has joined us in this effort to prevent
inadvertent web breakage and no longer updates the file at
http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js. That file
will stay locked at version 1.11.1 as well.

The following, now moot, answer is preserved here for historical reasons.


Don't do this. Seriously, don't.

Linking to major versions of jQuery does work, but it's a bad idea -- whole new features get added and deprecated with each decimal update. If you update jQuery automatically without testing your code COMPLETELY, you risk an unexpected surprise if the API for some critical method has changed.

Here's what you should be doing: write your code using the latest version of jQuery. Test it, debug it, publish it when it's ready for production.

Then, when a new version of jQuery rolls out, ask yourself: Do I need this new version in my code? For instance, is there some critical browser compatibility that didn't exist before, or will it speed up my code in most browsers?

If the answer is "no", don't bother updating your code to the latest jQuery version. Doing so might even add NEW errors to your code which didn't exist before. No responsible developer would automatically include new code from another site without testing it thoroughly.

There's simply no good reason to ALWAYS be using the latest version of jQuery. The old versions are still available on the CDNs, and if they work for your purposes, then why bother replacing them?


A secondary, but possibly more important, issue is caching. Many people link to jQuery on a CDN because many other sites do, and your users have a good chance of having that version already cached.

The problem is, caching only works if you provide a full version number. If you provide a partial version number, far-future caching doesn't happen -- because if it did, some users would get different minor versions of jQuery from the same URL. (Say that the link to 1.7 points to 1.7.1 one day and 1.7.2 the next day. How will the browser make sure it's getting the latest version today? Answer: no caching.)

In fact here's a breakdown of several options and their expiration
settings...

http://code.jquery.com/jquery-latest.min.js (no cache)

http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js (1 hour)

http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js (1
hour)

http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js (1
year)

So, by linking to jQuery this way, you're actually eliminating one of the major reasons to use a CDN in the first place.


http://code.jquery.com/jquery-latest.min.js may not always give you the version you expect, either. As of this writing, it links to the latest version of jQuery 1.x, even though jQuery 2.x has been released as well. This is because jQuery 1.x is compatible with older browsers including IE 6/7/8, and jQuery 2.x is not. If you want the latest version of jQuery 2.x, then (for now) you need to specify that explicitly.

The two versions have the same API, so there is no perceptual difference for compatible browsers. However, jQuery 1.x is a larger download than 2.x.

Where to find the jquery library link?

Copy one of these 2 urls into your code. They are from MAXCDN.
Production: http://code.jquery.com/jquery-2.2.0.min.js
Development: http://code.jquery.com/jquery-2.2.0.js

using google apis for jquery ui

If you are talking about linking to the jQuery UI libraries using the Google CDN (https://developers.google.com/speed/libraries/devguide#jquery-ui), you won't need to bother referencing any other js file for it locally. Just link to the Google hosted jQuery UI library, and you're good to go :) Make sure you also link to the jQuery library as well:

https://developers.google.com/speed/libraries/devguide#jquery

What are the advantages in including Jquery library from google's ajax api library?

5 Reasons Why Businesses Should Use CDN

7 Reasons to use a Content Delivery Network

CDN being Content Delivery Network (hosted libraries)

Though you should always have a local cache in case a remote store fails. (The HTML5 Boilerplate demonstrates this very well):

<!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if necessary -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.5.1.min.js">\x3C/script>')</script>

Is it safe to reference google's JQuery library?

Have the best of both worlds. Use theirs for fast, possibly pre-cached, delivery and in case their server goes down (more likely than them moving it) fallback to your own:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
if (typeof jQuery == 'undefined')
{
document.write(unescape("%3Cscript src='/path/to/your/jquery' type='text/javascript'%3E%3C/script%3E"));
}
</script>

Taken from: Best way to use Google's hosted jQuery, but fall back to my hosted library on Google fail

Should I link to Google API's cloud for JS libraries?

Pros: It may already be cached on the user's system. Google has big pipes. You don't pay for the bandwidth.

Cons: You now have two different ways for your site to become unavailable: A service interruption on your server or one on Google's server.



Related Topics



Leave a reply



Submit