Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

jquery
cdn
microsoft
google

How to add jQuery from a CDN?

Educative Answers Team

A content delivery network or content distribution network (CDN) is a network of proxy servers globally distributed throughout multiple locations where users can access cached content. It hosts resources such as images, and other CSS and javascript files.

The core purpose of CDN is to virtually shorten the physical distance between the end-users and the hosting-servers of the website the user wants to access. This results in improved content rendering time and website performance.

jQuery CDN

jQuery is a feature-rich JavaScript library which makes using JavaScript on your website easier.

It will take time to download jQuery library form your server and increases latency but if you don’t want to host jQuery yourself, then the best approach is to include it from CDN. Just include the script in your code and you are good to go.

Let’s look at the illustration for better understanding:

svg viewer
Using your Server
svg viewer
Using CDN

There are two ways of including jQuery, either from google or Microsoft.

Google CDN

<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>

Microsoft CDN

<head>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js"></script>
</head>

RELATED TAGS

jquery
cdn
microsoft
google
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring