开发者

Are scripts hosted at Google cached accross multiple sites?

开发者 https://www.devze.com 2022-12-29 22:22 出处:网络
If I vis开发者_开发问答it 1 website www.abc.com that has a reference to say jQuery hosted at Google Code, and then I visit a 2nd website www.xyz.com that has the same reference - will the file be cach

If I vis开发者_开发问答it 1 website www.abc.com that has a reference to say jQuery hosted at Google Code, and then I visit a 2nd website www.xyz.com that has the same reference - will the file be cached across both websites? i.e. will it re-download it on the 2nd website, or just use it from cache?


It will use the cache. This is the exact reason why they are hosted by Google.


Yes.

Also, if you use Google's loading api you get even faster loads then by just using the cache as it will use Google's CDN. For example:

<script src="http://www.google.com/jsapi?key=[inset Google API key here]">
<script type="text/javascript">
google.load("jquery", "1");
</script>


Yes. That is the point of using the library hosted on their site.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号