UnseenRevolution

Wordpress Tutorial: Load the jQuery Library From CDN

Some might say there is really just 1 thing to remember about making good Wordpress website. Make it fast. Speeding up your Wordpress site will improve user experience and also improve your sites SEO. Using a CDN to distribute your jQuery library is a great place to start.

There are at least 4 reasons you should use a CDN to service jQuery on your page:

Decreased LatencyContent Delivery Network — distributes your static content across servers in various physical locations. The User’s download will automatically target the closest available server in the network.

Increased parallelismTo avoid needlessly overloading servers, browsers limit the number of connections that can be made simultaneously. Depending on which browser, this limit may be as low as two connections per hostname.

Better cachingPotentially the greatest benefit of using the Google AJAX Libraries CDN is that your users may not need to download jQuery at all. If your user had downloaded the content in the past, it may already be cached.

Reduced bandwidth costsIf someone else’s CDN is pushing the content to your users, they are using their bandwidth, not yours.

All of these reasons add up to fast responsive websites. That may be the one thing that everyone agrees is a good thing.

Wordpress: Google’s jQuery CDN

I spend a good amount of time working in Wordpress environments. Seems like every theme comes with jQuery and the all use the local copy, obviously that is not a great idea, luckly there is a simple way to correct this oversight with just 6 lines of code.