jQuery it self´s, Google and Microsoft are offering jQuery (+ some well-known Plugins) for linking on their servers. More about this you can read here.
Why should I do this?
There are several reasons for using the hosted version:
- You save the traffic. jQuery and co. are able to take a lot of space on the traffic.
- Google and co. CDNs are created to do this job. If someone is able to offer such content very fast than networks like this.
- Many people use Google or Microsoft services or visit websites which are linked by their jQuery Version. That means, you have the big chance, that your browser already cached jQuery somewhere - shorter waiting times while loading!
- More information´s you will find on the Yahoo best practices site.
Which CDN is the best for me? Microsoft or Google?
At least both services are almost equal if we talk about the jQuery hosting. But probably there are more people using Google CDN - that means you have bigger chances if you use Google. On the other hand Microsoft included some gadgetry for ASP.NET developer with the Script Manager - but actually we don´t need it
Here is a little discussion on Stackoverflow: Microsoft CDN for JQuery or Google CDN?
Why shouldn´t we use it?
Of course there are also some disadvantages. You can´t use it for intern applications (but you don´t need it there) and also you need to trust the provider - anyway there is a kind of dependency.
What happens if there are any kinds of problems on Google/Microsoft/jQuery CDN?
Hm... In my opinion you shouldn´t be scared that one of the CDNs will go down but maybe there could be a problem reaching the CDN. Because of this I recommend you to create your own Backup and link it in emergency cases:
<script src="//code.jquery.com/jquery-1.4.4.min.js"></script> <script>!window.jQuery && document.write(unescape('%3Cscript src="LOKALER_JQUERY_PFAD"%3E%3C/script%3E'))</script>
Instead of "LOKALER_JQUERY_PFAD" you easily enter your own pad. In line one CDN jQuery is linked by jQuery. Little hint: If we talk about a HTTP side http://code.jquery.... Will be used. But HTTPS sides are called https:// ... . That´s because of this "//" Syntax.
If code.jQuery.com is down anyway
With Java Script the local version will be linked in this case automatically.