This may be obvious to some, but I\'ve been wondering: why should I depend on Google\'s server to host jQuery for my site?
Is it only because it loads faster this wa
This study by TJ VanToll convinced me that it's better to concatenate jQuery with other scripts rather than load it from a CDN.
The reason is the latency involved in fetching jQuery on mobile devices:
"In 2012 the average RTT time on a mobile network in the United States was 344ms. And that 344ms applies to not only every HTTP request – which the average web page now makes 93 of – but also every DNS lookup and TCP connection... While average RTTs are improving, there are only small additional gains to be had, as current networks are within a small factor of the theoretical limit dictated by physics."
He also cites this post from Steve Souders that shows why you're actually unlikely to get the caching benefit from using a CDN:
"Because of the fragmentation in CDN providers, jQuery versions, and protocol usage (http vs. https), the chances of getting a CDN cache hit are shockingly low – and downloading from an external domain has the potential to perform not one, but three round trips (a DNS lookup, a TCP connection, and an HTTP GET)."