I use the following for a jquery link in my <script>
tags:
http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js
Just wondered if anyone had discovered whether there's 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)
Source: Tips4all
You can use:
ReplyDeletehttp://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
To get the most recent version in the 1.x.x family or you could use:
http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js
To get the most recent version in the 1.7.x family.
EDIT:
In case anyone is interested Microsoft is also hosting jquery:
http://ajax.Microsoft.com/ajax/jQuery/jquery-1.7.1.min.js
EDIT 2:
jQuery is now hosting a version on their CDN:
http://code.jquery.com/jquery-latest.min.js
EDIT 3:
A list of the latest libraries and frameworks (including download links) can be found at scriptsrc.net.
http://code.jquery.com/jquery-latest.min.js
ReplyDeletethis is the minified version, always up-to-date
Be aware that caching headers are different when you use "direct" vs. "latest" link from google.
ReplyDeleteWhen using http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js
Cache-Control: public, max-age=31536000
When using http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js
Cache-Control: public, max-age=3600, must-revalidate, proxy-revalidate
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.
ReplyDeleteYes there is.
ReplyDeletehttp://code.jquery.com/jquery-latest.min.js
If you do this you always have the latest versions.
ReplyDelete<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
//<![CDATA[
google.load("jquery", "1");
//google.load("jqueryui", "1");
//google.load("swfobject", "1");
//]]>
</script>
Then call it with:
google.setOnLoadCallback(function(){jQuery(function($) {
// Enter your code block here
});});
No. There isn't..
ReplyDeleteBut, for development there is such a link on the jQuery code site.
Google doesn't allow the reference of jQuery's latest version.
ReplyDeleteWhen jQuery changes its major version, then you'll have to change the link.
Media Temple does. Here are the links:
- Development version - Production (Minified) version.
These links always refer to the latest versions.
jQuery also doesn't allow you to call their latest file over SSL, a consideration if you want to use jQuery in a shopping cart etc.
ReplyDeletee.g.
<script type="text/javascript" src="https://code.jquery.com/jquery-latest.min.js"></script>
will give you a security error.
Google's API will let you call over SSL:
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.7");
</script>
Here's a page where you can find links to the latest versions of jQuery, jQueryUI and Themes for Google and Microsoft CDN's. This page automatically updates with the latest links from the CDN.
ReplyDeletehttp://lab.abhinayrathore.com/jquery_cdn/