Thursday, April 14, 2011

AJAX CDNs

Both Google and Microsoft have AJAX/JavaScript/jQuery CDNs.

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.
The Libraries API takes the pain out of developing mashups in JavaScript while using a collection of libraries. We make it easy for you to host the libraries, correctly set cache headers, and stay current with the most recent bug fixes.

By taking advantage of the Microsoft Ajax CDN, you can significantly improve the performance of your Ajax applications. The contents of the Microsoft Ajax CDN are cached on servers located around the world. In addition, the Microsoft Ajax CDN enables browsers to reuse cached JavaScript files for Web sites that are located in different domains.

Both Microsoft and Google’s CDNs support HTTPS as well as HTTP, so they can be included in both. They also include both minified and full versions of the jQuery scripts.

Documentation on Microsoft’s AJAX CDN is here:
http://www.asp.net/ajaxlibrary/cdn.ashx
An example of loading jQuery from Microsoft’s CDN:
http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.2.min.js

Documentation on Google’s AJAX CDN is here:
http://code.google.com/apis/libraries/
An example of loading jQuery from Google’s CDN:
http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js
Google also has a “libraries API” so that JavaScript files can be loaded using code rather than inserting additional script tags:
http://code.google.com/apis/libraries/devguide.html