why do they give us an option?
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
Actually it seems like you do, since the CDN used here specifies a specific version (check the source).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.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
Not at all.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.
Most hosted APIs keep an archive of previous versions, just so people will not have to worry about changes breaking their site/project.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 .
Actually the jquery source on google is pretty flexible: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.
We use essential cookies to make this site work, and optional cookies to enhance your experience.