Hosted versus Local Resources

By: Dusty Arlia
Published on Tuesday, July 9, 2013, 01:40 PM
Last Updated on Friday, July 10, 2015 at 3:05 PM
Total Updates: 3

When you develop web-based applications, it's common to use resources from a CDN. The most commonly used resources from CDNs are libraries of code. It is usually a better option to host your library locally. You can get a speed and reliability advantage. Most CDNs are fast and reliable, but this is just one more DNS query and TCP connection to establish. You're better off with downloading your resource and then referencing its location on your server.

When you're referencing a JavaScript file, whether hosted locally or through a CDN, you are essentially doing the same thing with the same syntax. The only difference is to the location provided to the src attribute. With a locally hosted JavaScript file, the src attribute has the value of the location of the file on its own server. With a CDN-hosted JavaScript file, the src attribute uses the URL of the remote file.

Comments:

Ad: