Brief introduction
If your host is abroad, or at home but because the north-South interoperability problem open speed is not ideal, or the bandwidth itself is very small open speed is not fast, we need to do some other aspects of optimization to improve the speed of website access.
What is a CDN public library?
CDN Public Library refers to the common JS inventory placed in the CDN node, in order to facilitate the broad masses of developers directly call. Compared with the JS inventory on the server machine, the CDN Public Library is more stable and high-speed. The General CDN Public Library will contain all the most popular open source JavaScript libraries in the world.
Why refer to CDN Public library?
1. Reduce waiting time
2. Increase the speed of loading the page
3. Better caching
How do I reference a CDN public library?
Take Baidu, for example, to load jquery, embed the code shown below in your Web page.
<script src= "Http://libs.baidu.com/jquery/1.9.0/jquery.js" ></script>
If you want to cite Google's Cdn Public library and worry about Google's instability, then change the code to the following:
<script type= "Text/javascript" src= "Https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" >< /script><script type= "Text/javascript" >!window.jquery && document.write (' <script src= ' Jquery-1.8.2.min.js "></SCRIPT>");</script>
The meaning of this code is this: first to load the Google jquery library file, if the load fails, then directly load the jquery library file on its own server.
L--cdn introduced JS to improve access speed