Script merge promote JavaScript performance sample

Source: Internet
Author: User
Tags html page min

  Script merging can improve JavaScript performance effectively, and here's a good example, you can refer to the following

Page rendering is blocked for each <script> tag initial download, so reducing the number of <script> tags included in the page helps to improve the situation. This is not just for outside-chain scripting, but the number of inline scripts is also limited. When the browser parses an HTML page, every time a <script> tag is encountered, a delay is caused by the execution of the script, so minimizing the delay time will significantly improve the overall performance of the page.     Typically a large web site or network application relies on several JavaScript files. You can combine multiple files into one so that you can reduce performance consumption by simply referencing a <script> tag. File merging can be done either offline packaging tools or a real-time online service like Yahoo!combo handle.     Code as follows: <!--optimization before:-->  <html>  <head>  <title>script example</ title>  </head>  <body>  <p>hello world!</p>  <script type= "http:/ /yui.yahooapis.com/combo?2.7.0/build/yahoo/yahoo-min.js "></script>  <script type=" http:// Yui.yahooapis.com/combo?2.7.0/build/event/event-min.js "></script>  </body>  </html >    <!--optimization:-->  <html>  <head>  <title>script example</ title>  </head>  <body>  <p>hello world!</p>  <script src= "http:// Yui.yaHooapis.com/combo?2.7.0/build/yahoo/yahoo-min.js&2.7.0/build/event/event-min.js "type=" Text/javascript "> </script>  </body>  </html>   
Related Article

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.