views:

94

answers:

5

could one link the latest jquery from google code instead of having a local copy?

if yes, could someone provide me the link for it so i can link it in from javascript.

thanks!

+1  A: 

Link to Google's CDN

If you're using jQuery UI some of the default themes are also available on Google's CDN search for 'Google CDN' for direct links

Marek Karbarz
+2  A: 

yes you can and it is recommended as it will be faster and already cached on many users computers. that is the case on a public site.

it might be slower if you are on an internal network over a wan

ooo
that's not entirely true.
David
+3  A: 

Here is a good article for why you shouldn't host it locally

http://encosia.com/2008/12/10/3-reasons-why-you-should-let-google-host-jquery-for-you/

Jride
+2  A: 

latest source:

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

David
could u give me the root url so i can find all other versions and the latest next time?
weng
A: 

Yes, this is definitely recommended, and Google encourages you to do so.

I don't recommend grabbing the "latest" version by default (as David recommends), because changes in jQuery updates may break your code. Unlikely, but possible. Instead, link directly to a version you know works with your code. The current release is 1.4.2.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt;

They even support HTTPS too so you can use it on secure pages. They didn't use to but sometime in the last 6 months or so they added that in.

Sean