Home >Web Front-end >JS Tutorial >Script merging to improve javascript performance example_javascript tips
The initial download of each <script> tag blocks page rendering, so reducing the number of <script> tags a page contains can help improve this situation. This is not only for external link scripts, the number of embedded scripts must also be limited. Every time the browser encounters a <script> tag in the process of parsing the HTML page, it will cause a certain delay due to the execution of the script. Therefore, minimizing the delay time will significantly improve the overall performance of the page. <br><br>Usually a large website or web application relies on several javascript files. You can merge multiple files into one so that you only need to reference one <script> tag, which can reduce performance consumption. File merging can be accomplished through offline packaging tools or real-time online services like YaHoo!combo handle. <br></p>
<div class="codetitle">
<span><a style="CURSOR: pointer" data="21647" class="copybut" id="copybut21647" onclick="doCopy('code21647')"><u>Copy code</u></a></span> The code is as follows:</div>
<div class="codebody" id="code21647"> <br><!-- Before optimization: --> <br><html> <br><head> <br><title>Script Example</title> <br></head> <br><body> <br><p>Hello world!</p> <br><script type="http://yui.yahooapis.com/combo?2.7.0/build/yahoo/yahoo-min.js"></script>