Using CDN for jQuery – Google and Microsoft

Using CDN for jQuery is a very good practice and has lots of benefits over using jQuery from local.

Using CDN for jQuery – Google

Using CDN for jQuery –¬†Microsoft

Benefits of CDN over local

1. Faster Access
Using CDN means the jQuery files will be accessed faster over the internet from CDN in comparision to the file that you may use from your server.

2. Use of Cached File
Since many other application already use jQuery files from CDN, they will get downloaded in the client’s browser cache. So when the client accesses your application, it will use the jQuery that already cached.
This will increase faster downloading of application.

3. Location Specific access
Since Google and Microsoft have their data centers all across the globe, the jQuery file will get downloaded in faster time as it gets downloaded from the closet datacenter.
e.g. If your application is hosted in North America and a user from Africa is trying to access the application, then if Jquery was to be downloaded from the server, it would have taken longer time.
But using CDN for jQuery, the file gets downloaded from the nearest available datacenter. This results in faster downloads.

4. Ease of using latest jQuery file.
Although not recommended. Please read full details here on jQuery Blog for not using jquery-latest-js.

 

What if the CDN server is offline?

If the CDN is offline or you are not able to connect to internet for local development then you can always go back to the local copy
Please see the code below

Using minified version

For more faster downloaded from CDN you can use the minified version of jQuery files

Thank you for reading this article.

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn