Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a link to the "latest" jQuery library on Google APIs? [duplicate]

I use the following for a jQuery link in my <script> tags:

http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js

Is there a link to the "latest" version? Something like the following (which doesn't work):

http://ajax.googleapis.com/ajax/libs/jquery/latest/jquery.js

(Obviously not necessarily a great plan to link your code to potentially changing libraries but useful in development.)

like image 316
Nick Pierpoint Avatar asked Jan 14 '09 00:01

Nick Pierpoint


People also ask

What is Google CDN jQuery?

Google provides CDN support for jQuery via the googleapis.com domain. The latest version of Google CDN provides four different types of jQuery versions- normal (uncompressed), minified, slim, and slim & minified. Google CDN provides the jQuery via ajax.googleapis.com domain.

What is a jQuery library?

What is jQuery? jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.

What is slim version of jQuery?

It's worth noting that Bootstrap 4 (the latest version of the framework) uses the slim version of jQuery.


2 Answers

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

like image 102
20 revs, 13 users 22% Avatar answered Oct 17 '22 23:10

20 revs, 13 users 22%


DO NOT USE THIS ANSWER. The URL is pointing at jQuery 1.11 (and always will).

Credits to Basic for above snippet

http://code.jquery.com/jquery-latest.min.js is the minified version, always up-to-date.

like image 94
Jacob Avatar answered Oct 18 '22 00:10

Jacob