jQuery链接与下载? [英] jQuery Linking vs. Download?
问题描述
谢谢,
Tracy
Google代码网站:
Google直接与每个图书馆工作的
利益相关者
一起工作,并接受最新的稳定版本
,因为它们被发布。一旦我们承担给定图书馆的
版本,我们将
承诺无限期地托管该版本
。
Google托管jQuery库的要点之一是将其缓存在一个地方。请考虑以下情况:
- 用户访问站点A
- 站点A在同一个域上具有jQuery ,所以该文件由浏览器下载
- 用户访问站点B
- 站点B在同一个域上具有jQuery,因此该文件由浏览器第二次。
现在,如果我们都从Google服务器上获取了jQuery,情况就是这样的:
- 用户访问网站A
- 网站A从Google加载jQuery,因此可以通过浏览器下载
- 用户访问站点B
- 站点B从Google加载jQuery,但浏览器已经下载并缓存,因此再次提取文件是即时的。 >
Which way is better? To link to the jQuery Pack at http://ajax.googleapis.com. Or to download the appropriate file and link locally? Does it matter? Is there a chance the link may disappear? Or is there a chance the file online will be updated, and it's better to link to it? Curious.
Thanks, Tracy
From the Google Code site:
Google works directly with the key stake holders for each library effort and accepts the latest stable versions as they are released. Once we host a release of a given library, we are committed to hosting that release indefinitely.
One of the main points of Google hosting the jQuery library is so that it is cached in a single place. Consider the following scenario:
- User visits site A
- Site A has jQuery on the same domain, so the file is downloaded by the browser
- User visits site B
- Site B has jQuery on the same domain, so the file is downloaded by the browser a second time.
Now if we all fetched jQuery from the Google servers, the scenario goes like this:
- User visits site A
- Site A loads jQuery from Google, so it's downloaded by the browser
- User visits site B
- Site B loads jQuery from Google, but the browser already downloaded it and cached it, so fetching the file again is instantaneous.
这篇关于jQuery链接与下载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!