Msg#: 4682544 posted 2:27 am on Jun 25, 2014 (gmt 0)
For those that have been hiding under a rock, we don't always need to download and host files like jQuery, Bootstrap, etc., we can directly link to them from our HTML to CDN's that host them instead of downloading them locally.
The upside to using the CDN:
1) browsers have limits to how many files it can load concurrently from a single domain which is why the CDN frees up more sockets for your domain and also the odds are the common CDN sources are already cached meaning your client ISN'T downloading the content from scratch very often. Other sites easily resolve this problem by making subdomains for downloading page resources such as www1.example.com, www2.example.com, etc. and let the load balancers sort it out thus speeding up the page display.
2) It's an easy way to make sure you always have the most current and updated code without downloading it to all your sites. Just as a security/update method putting all those files on a common subdomain such as "resources.example.com" wouldn't be such a bad idea instead of installing them per site.
3) Makes using developer prototyping tools like jsFiddle easy as heck, but then again we all knew that. I'm all for using 3rd party CDN to fiddle around.
Here's a few CDN's to try:
If you're not aware it exists: http://www.jsdelivr.com/
Then there's this thing... http://code.createjs.com/ from http://createjs.com
Of course the usual suspects we already know... http://cdnjs.com/ from https://github.com/cdnjs/cdnjs http://www.asp.net/ajaxlibrary/cdn.ashx https://developers.google.com/speed/libraries/devguide?csw=1
One thing I've noticed about sites using CDNs is they can often be the "holding back the page load" factor - presumably when the CDN finds itself under a particularly heavy load. Amazonaws is the one I notice more than others (comments won't load on a blog I frequent until something from amazonaws downloads).
You also open yourself to XSS attacks, based on the respectability and security practices of the CDN you use. If the code on the end is outside of your control, it can be changed to something you don't want it changed to. It may be picked up pretty quickly, but the damage may already be done by then.
Local CDNs however, which you outline in your second point, are in my opinion an excellent idea, and something I already use regularly.