L--cdn introduced JS to improve access speed

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.