Charlie Calvert on Elvenware

Writing Code and Prose on Computers


Online Code and CDN Explained

CDN stands for Content Delivery Network. The goal of CDN is to store important libraries at an URL so that you can include that URL in the head element of your HTML files when you need to link in a particular library. Some of the CDN sites, such as Google's, link to a wide range of libraries. It is therefore worthwhile becoming familiar with that CDN site, and the libraries that it caches for you. Other important sites include the jQuery CDN and the Microsoft CDN.

An example of using CDN:

<script type="text/javascript" src=""></script> 

It may surprise you to learn that it is probably best to use http://XXX style URLs in your code rather than hosting the files yourself. Although there could obviously be exceptions to this rule, it should be obvious that Google, jQuery or Microsoft will do a better job of caching and serving up these files than your site. So if you host your site on the web, go ahead and use this technique. If you hose your site for Intranet that lies behind a firewall, then maybe you should and maybe you shouldn't. My guess is that you probably should. But if you are on a public site, then use the URL that points to a public CDN.