Some of my favourites:
<link href="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/themes/ui-lightness/jquery-ui.css" rel="stylesheet">
More jQueryUI: (from the Official Blog post)
- Uncompressed: http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/jquery-ui.js
- Compressed: http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/jquery-ui.min.js
base, black-tie, blitzer, cupertino, dark-hive, dot-luv, eggplant, excite-bike, flick, hot-sneaks, humanity, le-frog, mint-choc,overcast, pepper-grinder, redmond, smoothness, south-street, start, sunny, swanky-purse, trontastic, ui-darkness, ui-lightness, and vader.
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">
- Your site will load faster for most users
– CDN always serves the files from the server closest to the user
– They have set the proper cache header to enable client caching
– If another site also uses the CDN hosted library, the user already have local cache, so loads even faster
- Save bandwidth and loading
– JS files are not as large as images, but if your site is a popular one, the traffic and loading can adds up to a large number
- Simplify your development
– If you’ve decided to use libraries hosted on CDN, there’s no need to download the library and put it in your web project again. Just copy and paste the HTML code and it’s working! It’s particularly useful for small scale projects and you never need to include the 3rd party code in your repository.
Drawbacks: things you should consider
- Reliability concerns
– If the CDN is down, your site will follow (or at least looks broken). In fact It did happen, the Cloudflare was down last week, so the links from cdnjs was instantly inaccessible. One of the project I’m working on is affected, finally I changed to Google CDN libraries.
- Offline webapps
– Obviously it won’t work if the user is offline, so if your web app will probably run offline, you’d better include the libs in your web project.
– Using external links imposes a security risk on your system. If your link come from malicious sites, they can change the content of the library and, for example, add a key-logger script to eavesdrop the passwords. Use only links from trusted parties such as Google. ( or is it? 😛 )
- Lack of customization
– If you want your own build of the library, say your own brew of jQueryUI theme, obviously you cannot do that. Most of these are vanilla version of the library.