Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is it recommended loading jQuery or any other library from a CDN?

Tags:

cdn

Kind of self-explanatory question: Why is it recommended loading jQuery or any other library from a CDN?

like image 805
Rodrigo Souza Avatar asked Oct 29 '10 13:10

Rodrigo Souza


People also ask

What is main advantage of loading jQuery library using CDN?

The user can access the file from computer server nearest to its location and it makes overall access to web pages easy and faster.

Why is it advantageous to server jQuery from a CDN?

1: jQuery CDN is Simple to Use The jQuery CDN is popular among web developers because it is simple to use and understand. Because the jQuery download file employs open coding standards and simple syntax, developers do not have to spend much time implementing it on their site or application.

What is the use of jQuery library?

jQuery is the most popular library on the web today. It's a library of JavaScript functions that make it easy for webpage developers to do common tasks-- like manipulating the webpage, responding to user events, getting data from their servers, building effects and animations, and much more.

Should I download jQuery or use CDN?

Using CDN is preferred as it improves the site performance. Yes, users accessing a site from behind strict firewall rules can face issues to access CDN urls. In that case you can download jQuery. I would advise using bower to install it so you can upgrade / maintain jQuery easily.


1 Answers

  • A CDN will be quicker than your server.
  • Servers have maximum number of connections. Browsers restrict the number of simultaneous requests to a single domain. Off loading your libraries to CDN stops both of these.
  • If everyone loads their jQuery library from Google's CDN, the resource will be shared between websites, and the same version of jQuery doesn't need to be loaded multiple times (from different servers).
  • It's cheaper for you ;) - Save bandwidth!
like image 131
Matt Avatar answered Sep 28 '22 01:09

Matt