The full name of the CDN is the Content Delivery network, which is the contents distribution networks. The goal is to add a new layer of network architecture to the existing Internet, publish the content of the site to the "Edge" of the network closest to the user, so that users can get the content they need, solve the congestion on the Internet, and increase the responsiveness of users to the site. The problem of the slow response speed of the user visiting website caused by the small network bandwidth, the large number of users, and the uneven distribution of dot is comprehensively solved technically. For more information see here: Http://code.google.com/p/mydocspace/wiki/CDN
I think we are not unfamiliar with the JavaScript like the one below.
1 |
<script type= "text/javascript" src= "http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js" ></script> |
The above is to load the jquery library file via Google's cdn-content Delivery network (content distribution networks).
But there are a lot of friends who put the jquery library files on the server to load, of course, this method for those server stability is very good to say nothing. If you're looking for details, it's recommended to load Google jquery. Speaking of some of the students here will ask why the bias to load Google jquery library it? Let me talk to you about the benefits of using Google to load jquery library files.
- Maybe loading jquery from Google is not necessarily faster than your site. But when visitors visit other Google jquery library sites to visit your site, the browser detects the jquery library version, and the same version of the jquery library points to Google's link, which the browser will judge as a file. And Google's server will return a 304 (no need to modify the file instructions, that is, the file on the server has not changed) to reply to a duplicate request, and will command the browser to cache the file for up to a year. In this way, the same version of the jquery library exists in the browser's cache without loading.
- Load Google jquery to reduce server requests.
- Is the use of foreign space friends, take me to this, the server is very unstable, and sometimes other content is loaded but JS file is not loaded (this refers to loading the server above the JS file).
Google jquery to load the benefits of a lot, but it is known that the celestial world is very offensive to Google, Google often can not access, if we load Google jquery does not fail it?
Let me tell you a way to load Google jquery based on conditions.
1 |
<script type= "text/javascript" src= "http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js" ></script> |
2 |
<script>!window.jQuery && document.write( ‘<script src="/js/jquery-1.3.2.min.js"></script>‘ );</script> |
Put the above code in the
Use Google's CDN jquery library