Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

Is there any reason why it would be something of advantage to refer to your jquery library from your server?

<p>its quite known that using Google HostedLibraries is of a big advantage due to better caching however I see some sites refer to jquery on their servers and cdn instead.So why they do so ?</p>

user-image
Question ajoutée par Rahaf Nawash , Front End Engineer , Atypon Systems Inc.
Date de publication: 2014/11/21
Majid Hameed
par Majid Hameed , Senior Java Developer , Check24 Vergleichsportal GmbH

Some reasons are:

1. Avoiding Extra DNS Lookup

They don't want to add DNS lookup time (generally very small fraction of time) required to look up Google or Microsoft or any other CDN servers.

2. Google Servers blockage

In the past you know some countries blocked YouTube (hosted by Google). Resulting in unnecessary blockage of Gmail and other Google Services.

3. Reducing number of HTTP Requests

May be some people decide to munge/combine several JS scripts to reduce the no. of http request in web page for performance optimization.

4. Intranet Website

Your website (webserver) is non public facing i.e. Intranet only having no or very slow internet access.

5. Getting Benefit of Keep Alive

If you use CDN and fetch your script from there. The extra over head of making a new TCP connection is added. It will reduce the your benefit of Keep Alive.

 

 

 

Ashraf Fahmi Abdelhamid Mahmoud
par Ashraf Fahmi Abdelhamid Mahmoud , Senior Software Engineer , DataServe - National DataServe & Turnkey Solutions Co

CDN To reduce the impact of downloading a library.

A CDN stores copies of a library in many different locations on the Internet.Browsers download whichever copy of the library is closest to them,

reducing latency and eliminating the extra bandwidth required of your web server.

Additionally, if the browser has visited another webpage that uses the same version of the library from the same CDN, it can use the cached version, further improving page-load time,

so you will get a greater performance benefit by using

the most popular CDN.Microsoft, Google, and Edgecast all provide CDN services for the jQuery library. Instead of referencing jQuery from your local server.

More Questions Like This