Hi guys, I wanted to know, would it be faster to link to my own copy of jquery.js or jquery.com's? Thanks in advance, -Tony
Here is a good post which explains the benefits for using a CDN version of jQuery: http://encosia.com/3-reasons-why-you-should-let-google-host-jquery-for-you/ And check out this page for CDN links: http://docs.jquery.com/Downloading_jQuery Personally, I don't use the CDN versions, because I generally combine all JavaScript into one file anyway, so CDN's wouldn't have a huge effect.
The article in 3 lines. CDN - Content Delivery Network Decreased latency: jQuery will download faster because it is downloaded from the CLOEST available server. increased parallelism: Web browsers limit the number of connections that can be made simultaneously to a domain. Using CDN, allows one more connection available for your site to load faster. Better caching: The probability of the user already having the jQuery file is quite high since thousands of sites already link to Google's CDN. Recommendation: Use Google's CDN.
And, just in case Google is down for a few seconds, I do a fallback to Microsoft, then to my local file. if (typeof jQuery == "undefined") { } Code (markup):
Try JQuery because it should download faster because it is close to the available server. If that doesn't pan out as I've mentioend, try the second option.