Why jQuery CDN?
Host jQuery? While you can always download jQuery from the official site and run it from your server, using a jQuery CDN is preferable. WordPress has inbuilt jQuery which updates automatically with each new WordPress version as many WordPress Plugins use jQuery. You can replace WordPress jQuery with CDN jQuery.
Which CDN? It is always a good idea to use jQuery hosted from a free CDN and a popular CDN such that your site loads faster and users across the globe can load the script faster from the CDN server nearest to their geographic location. Moreover, it also ensures the script is already cached in your user’s browsers by visiting previous sites loading this script and ensures your site loads even faster.
How to add CDN Link? The typical way to load jQuery is in your site footer at the end after all content is loaded. The code will typically look like this.
Which jQuery version to use? jQuery is provided in three different series. Right now it is 3.4.1, 2.2.4, and 1.12.4. While it is recommended to use the latest versions, the series may vary depending on your project requirements and compatibility.
Best jQuery CDN Links
So here are the best jQuery CDNs you can try…
1. Google Hosted Libraries
This Google jQuery CDN is possibly the most popular and since most people use it, there are higher chances this is already cached, and of course, Google is expected to have great speed, performance, uptimes, and reliability. They advise you to load libraries from the CDN via HTTPS, even if your own website uses HTTP, as caching works just the same. The CDN’s files are served with caching allowed for 1 year. You can also choose from multiple variants like JQuery UI CDN, jQuery Mobile CDN. They provide the minified link by default. They make the 3 jQuery series available as direct links
2. Microsoft Ajax CDN
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.min.js"></script></code >
3. cdnjs CDN
They have an extensive list of all possible previous versions of jQuery, which means if you are using any older jQuery version and wish to use CDN, it’s possible with this service.
4. JSdelivr CDN
Note that all have secure https URLs and will have added SSL negotiation times. Choose between these and you can check the page speeds to see which works best for your target audience.