Why should I use a CDN (content delivery network) to include jQuery over downloading the jQuery library to my project?


#1

Question

Why should I use a CDN (content delivery network) to include jQuery over downloading the jQuery library to my project?

Answer

When we use a CDN our content (in this case the jQuery library) may potentially load faster than if we hosted jQuery on our own server (by downloading it to our project) as the content will be coming from the nearest possible data server in relation to our user. With a CDN there is also the potential that the same version of jQuery will be cached (saved locally) to our user’s web browser and available for our site to use without having to make another request to a server for the same file.