Are scripts hosted at Google cached accross multiple sites?
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.
精彩评论