XF 2.2 What does jQuery source CDN do?

Black Tiger

Active member
I'm no programmer, no website dev/css no clue on what this does except that you can host images on a CDN. But jQuery? No clue.

Suppose I choose for Google Ajax API CDN, would this speed up anything compared to locally hosted? Would this need extra settings anywhere else like in config.php or something?
Is this giving a real benefit against locally hosted?

I'm mostly looking for some method to speed up my adsense blocks. I've only got 2 ad blocks but they do have the most speed impact.
And I don't know if this can be used for it some how.
Or is the only way to speed up to limit the ad size?
 

briansol

Well-known member
putting the library on the cdn allows for the chance that your visitors have visited a different website also leveraging the cdn, which means they don't have to download the JavaScript again.

this just changes the url to google.com/jquery.js (simplified) instead of your.com/jquery.js

scenario:
Sitea.com -> brings in javascript from cdn
caches locally in browser
visits your site, using cdn -> reads from local cache, saving the download (and load time).

if the user goes to your site first and doesn't have a local copy, it will course from the cdn and then subsequent visits will use the cache both on your site and elsewhere


since so many sites use these hosted cdn's, odds are high that your visitors will save the download hit.


I used to use the cdn, but i have switched to running local due to attempting to run stricter content security policies (advanced topic). I would recommend using one of the public CDN's in most cases.

google api is fine.


it really won't change a thing for your ads.
 

Black Tiger

Active member
Thank you very much for the explanation and your insight @briansol

So if I understand you both correctly, it's might be better to use the Google CDN for jquery.
And I don't have to configure anything for it, just tick the option and hit save and that's all?

I don't intend to use CDN for other things (like images) because our server is fast enough, and things are looking good!
 

briansol

Well-known member
correct, just enable serving it from elsewhere.

As chromaniac mentions above, future browser releases may negate the advantage of serving it via 3rd party, though. You can always change it with the option later.
 
Top