What is 'jQuery Source'?

Vilandra

Active member
Hi all :) I'm dumb and don't really know which option is the best to choose here. What is it and is it better to use the local source or choose an external one? Thanks!
 
Unless you have a specific reason to be using a different jQuery library, you can just leave it on local which means it will run from your own server.

However, setting it to Google will most likely mean most visitors will already have a cached version on their PC.

jQuery is software which enhances the browsing experience with little bits of eye-candy, animations, pop-ups, overlays, etc.
 
found some discussion on another site:


The main point of the CDN is caching. If a user hits 100 JQuery sites, the library will only be downloaded once, and the remaining 99 sites will pull it from the local cache. From an operation cost, you also get to offload the cost of server Javascript to Google. As an added bonus, I also find it easier as a developer to kick off a new project by just linking to the CDN – no need to download and copy the latest version of JQuery.
Great. So when not to use a CDN?
Obviously, whenever you’re working offline. This sometimes occurs as a developer working locally, and with Single Page Applications like TiddlyWiki. (The next “major minor” release of TiddlyWiki, v2.5 is JQuery-powered.)
Another case would be when you can deliver faster than the CDN, and care about that. This might be the case when all users are close to the server. Even then, though, you won’t get the local cache benefit from users who already have the JQuery.
Finally, privacy and security concerns. Using the CDN, you are trusting the CDN to faithfully serve JQuery and relying on no third-parties injecting funniness in between the CDN and your user’s browser. If anything went wrong here, your user could be subject to a world of XSS and CSRF attacks. Or, in a more mundane scenario, the CDN might simply go down, thus breaking your web app. Furthermore, you’re giving the CDN data about your users this way. Although Google doesn’t use cookies, others might; and even if they don’t, the IP number is going to be sent back to them. The referrer – being your website – will also be sent to them, so they can, if they want, track your website’s usage.
For many websites, though, it’s great that we can use a reliable CDN like Google’s to fetch JQuery fast.

http://softwareas.com/google-jquery-cdn
 
found some discussion on another site:

The main point of the CDN is caching. If a user hits 100 JQuery sites, the library will only be downloaded once, and the remaining 99 sites will pull it from the local cache. From an operation cost, you also get to offload the cost of server Javascript to Google. As an added bonus, I also find it easier as a developer to kick off a new project by just linking to the CDN – no need to download and copy the latest version of JQuery.
Great. So when not to use a CDN?
Obviously, whenever you’re working offline. This sometimes occurs as a developer working locally, and with Single Page Applications like TiddlyWiki. (The next “major minor” release of TiddlyWiki, v2.5 is JQuery-powered.)
Another case would be when you can deliver faster than the CDN, and care about that. This might be the case when all users are close to the server. Even then, though, you won’t get the local cache benefit from users who already have the JQuery.
Finally, privacy and security concerns. Using the CDN, you are trusting the CDN to faithfully serve JQuery and relying on no third-parties injecting funniness in between the CDN and your user’s browser. If anything went wrong here, your user could be subject to a world of XSS and CSRF attacks. Or, in a more mundane scenario, the CDN might simply go down, thus breaking your web app. Furthermore, you’re giving the CDN data about your users this way. Although Google doesn’t use cookies, others might; and even if they don’t, the IP number is going to be sent back to them. The referrer – being your website – will also be sent to them, so they can, if they want, track your website’s usage.
For many websites, though, it’s great that we can use a reliable CDN like Google’s to fetch JQuery fast.

http://softwareas.com/google-jquery-cdn

Another reason you might prefer to use the local copy would be to avoid the possibility that the version Google serves via the CDN might be upgraded to a newer version that causes some functionality in XF to break. You have no control over the version on the CDN, so you wouldn't be able to test it first to make sure it doesn't conflict with anything on your site.
 
Another reason you might prefer to use the local copy would be to avoid the possibility that the version Google serves via the CDN might be upgraded to a newer version that causes some functionality in XF to break. You have no control over the version on the CDN, so you wouldn't be able to test it first to make sure it doesn't conflict with anything on your site.
Actually it seems like you do, since the CDN used here specifies a specific version (check the source).

HTML:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
 
Another reason you might prefer to use the local copy would be to avoid the possibility that the version Google serves via the CDN might be upgraded to a newer version that causes some functionality in XF to break. You have no control over the version on the CDN, so you wouldn't be able to test it first to make sure it doesn't conflict with anything on your site.
Not at all.

XenForo uses jQuery 1.4.4 (At least my board does), and it grabs that version from the CDN's listed.

Most CDN's that host jQuery keep all previous versions.

I'll kill you Oni :mad:
 
Heh. Fair enough. Hadn't seen that it was versioned in the CDN. :)
Obviously that makes a lot of sense, I suppose I was generalizing from the way I've seen CDN's used via an origin pull.
Well that gets my foot chewing out of the day for the evening... Must remember to add some pepper to my socks ;).
 
Heh. Fair enough. Hadn't seen that it was versioned in the CDN. :)
Obviously that makes a lot of sense, I suppose I was generalizing from the way I've seen CDN's used via an origin pull.
Well that gets my foot chewing out of the day for the evening... Must remember to add some pepper to my socks ;).
Most hosted APIs keep an archive of previous versions, just so people will not have to worry about changes breaking their site/project.
 
Another reason you might prefer to use the local copy would be to avoid the possibility that the version Google serves via the CDN might be upgraded to a newer version that causes some functionality in XF to break. You have no control over the version on the CDN, so you wouldn't be able to test it first to make sure it doesn't conflict with anything on your site.
Actually the jquery source on google is pretty flexible:
http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js - uses the latest version of 1, which is currently 1.5.1, if 1.5.2 came out, it would soon use 1.5.2. Later on if 1.6.0 is released, it'll use that version.
Similarly, if you use http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js it will use the latest version of 1.5, but not 1.6 and on.

If you explicitly state to use 1.5.1 in the URL:
http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js and version 1.5.2 came out, you'd still be serving the 1.5.1.
 
Top Bottom