Speed up your site with CDN Javascript

There are many ways of optimizing a site. If you’re using some of the popular javascript libraries, it might be worth spending a few minutes looking at the some of the free online CDN services.

Switching to a online CDN hosted javascript library is easy, and can be implemented in less than 10 minutes.

In this post we’ll take a look at the general benefits, and some of the most popular free Javascript CDN libraries.

Benefits of a CDN hosted lavascript Library

Loading javascript files from a common public location has the following benefits:

  • Potential faster page speed. If new users on your site already has downloaded the same js library from another page, the library will  be served from the users cache, meaning no download required and faster page speed. The speed improvement depends on the number of sites that are using the same  javascript CDN library.
  • Less bandwidth. Using a CDN means that the Javascript library file will be served from the CDN server and not from your own server.
  • Less server load. Since the server requests are handled by a remote server, using a CDN also reduces the server resources required to display your pages
  • Less maintenance. The JS libraries on the CDN will (hopefully) automatically be upgraded, which means that you don’t have to spend time ensuring that you’re running the latest version.

However it also introduces a few potential risks:

  • External dependency. When adding links to a CDN, you also creates a dependency of the remote service.  If the remote service isn’t run professionally in terms of server uptime, response times etc. – it could mean problems for your site.
  • You’re not noticed when new versions of Javascript libraries are rolled out on the CDN. This can make testing of new releases, and compatibility difficult.

Google Libraries API

One of the oldest and most used free javascript CDN libraries is Google Libraries API. The widespread usage of this library means that a lot of users will already have this library cached. Google is normally providing high uptime and fast response times, so using this library has a high likelihood of increasing your site performance.

Google Libraries javascript cdn

The only limitation of Google Libraries API, is the limited amount of scripts provided. Currently the following libraries are supported.

  • Chrome Frame
  • Dojo
  • Ext Core
  • jQuery
  • jQuery UI
  • MooTools
  • Prototype
  • script.aculo.us
  • SWFObject
  • Yahoo! User Interface Library (YUI)
  • WebFont Loader

Microsoft Ajax CDN

As part of the Microsoft ASP.net website, Microsoft also offers a CDN service for a limited range of Javascript Libraries. The CDN service from Microsoft has been on the market for a few years which indicates a good distribution on many sites. You can therefore expect a decent speed benefit – using this CDN.

Microsoft Net Ajax CDN

The Javascript libraries available on Microsoft ASP.net CDN is quite limited:

  • jQuery
  • jQuery UI
  • jQuery Validation
  • jQuery Cycle
  • Ajax Control Toolkit


CDNJS is a relatively new and free Javascript Library CDN. Compared to Google Libraries API, this means that the speed benefits of using the api will initially be limited, however this might change when the distribution gets better. The benefit of CDNJS is the number of Javascript libraries supported.

CDNJA a new javascript CDN library

Currently more than 27 libraries are supported, and new libraries are added on a regular basis. If you miss a Javascript library in CDNJS, you can add a post in the forum, and if the demand for library is big enough, it will be added to the site.

Among the Javascript libraries found on CDNJS are:

  • dojo
  • less
  • jQuery
  • Modernizer
  • Mootools
  • json2


If you’re using some of the common Javascript libraries on your site, using some of the free Javascript CDN services could be a good idea. You’ll save time updating and patching the libraries, and your users might experience a speed improvement of your site.

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS
fold-left fold-right
About the author
Jørgen Nicolaisen has been passionately interested in everything online since 1995. His experience is based on working with small hobby projects as well as high volume websites. Jørgen is currently focused on the PHP based programming framework - Codeigniter, and WordPress naturally

Comments are closed.