views:

118

answers:

7

There are some tutorials which suggest to use jquery path which is from google eg:

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

Is that safe to use in our projects?

Aren't we dependent because we are not sure it will be there after a year or beyond?

The reason why I have asked this question is that there are some people who go in favor of that.

+7  A: 

From the documentation:

Google works directly with the key stake holders for each library effort and accepts the latest stable versions as they are released. Once we host a release of a given library, we are committed to hosting that release indefinitely.

It seems pretty low-risk to me. And more likely to be already in the user's cache. And served with the proper gzip and caching headers. Also won't eat up a http request to your domain on browsers that only allow downloading 2 requests to a domain at a time (e.g. IE6 and IE7).

Annie
+1  A: 

Short answer is yes and I agree if that include doesn't work it is probably a sign of a much bigger problem. My general rule of thumb is for all public facing apps I use that include where as internal apps (which theoretically could be used w/o a connection to the outside world) I include a local copy instead.

Nicholas Kreidberg
A: 

There will be always a chance that it will not be there after a year, same as gmail, gdocs, google.com...

for jquery alone, i do not see a reason to use google source, as the file is small, impact to your server and BW will not be too much. But jquery UI may worth to use google's source.

joetsuihk
A: 

It's pretty 'safe' like what the other guys mentioned. You probably ease a bit of load of your own server too. Even SO itself is using it.

But to be safe, always have a fallback plan and have a local copy, just in case.

o.k.w
A: 

There's not really much risk involved if you think about it. Suppose Google ceases to exist in a year (chuckle), it wouldn't take you but a couple of minutes to replace the google.load command in your common file with a reference to your own local jQuery copy.

The worse-case scenario is that in the improbable future of Google's demise, your hover-effects stop to work for 5 minutes :)

Jonathan Sampson
+3  A: 

I have an article for you that explains the benefits and cons of using this method: Here
I really doubt that google will put this up for people to use and then all of a sudden take it down and cause issues with thousands or more websites. It's not like they will lose their domain or run out of bandwidth. The only issue that I think you should worry about is if the end users of your sites cannot access google. Personally I just host the file on my own server anyway

Arch
A: 

A similar question: http://stackoverflow.com/questions/547384/where-do-you-include-the-jquery-library-from-google-jsapi

Because of the answers from that question, I have started using:

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

I have it running on quite a number of sites. The only issue I've had is some firewalls start blocking a site if there are too many requests (or at least this is my guess), which is the case on higher traffic sites all used in one location.

Darryl Hein