CDN stands for Content Delivery Network (CDN. The purpose is to add a new network architecture to the existing Internet to publish website content to the "edge" closest to the user's network ", this allows users to obtain the desired content from the nearest node to solve the problem of Internet congestion and improve the response speed of users accessing the website. Technically, it solves the slow response speed caused by low network bandwidth, large user traffic, and unevenly distributed outlets. For more information, see here: http://code.google.com/p/mydocspace/wiki/CDN
I think you are familiar with the following javascript code.
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
In this way, the jquery library file is loaded through Google's CDN-Content Delivery Network.
However, many friends store jquery library files on the server for loading. Of course, this method is not good for those servers. For details, google jquery is recommended. Speaking of this, some students asked why google jquery library should be loaded? Let me talk about the advantages of using Google to load jquery library files.
- Maybe loading jquery from Google is not necessarily faster than your site. However, when a visitor accesses another site that loads google's jquery library to access your website, the browser will detect the jquery library version. The jquery library of the same version points to the google link, the browser will determine that this is the same file, and Google's server will return a 304 (no command to modify the file, that is, the file on the server has not been changed) to reply to a duplicate request, it also commands the browser to cache the file for up to one year. In this way, the jQuery library of the same version does not need to be loaded in the browser cache.
- Load google jquery to reduce server requests.
- It's just friends who use space outside China. Let me take this for example. The server is very unstable, sometimes other content is loaded, but the JS file cannot be loaded (this refers to loading the JS file on the server ).
Although there are many advantages to loading google jquery, it is well known that tianchao is very disgusted with google's stuff and google often cannot access it. If we load google jquery, will it fail?
The following is a method for loading google jquery based on conditions.
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script><script>!window.jQuery && document.write('<script src="/js/jquery-1.3.2.min.js"></script>');</script>
Put the above Code in