script elements

 async:  

  Asynchronous script , the script for downloads immediately, without prejudice to the page in other operations, such as downloading other resources, or wait to load other scripts. And it is valid only for external scripts.

defer:

  Delay the script , the script may indicate delayed until after the re-implementation of the document is completely parsed and displayed. And it is valid only for external scripts.

 

More than two labels are for external file:

  In general as an external file containing JavaScript code. External scripts advantages are as follows:

      Maintainability : do not touch the case of HTML tags, concentrate on editing JavaScript code.

      Cacheable: the browser can cache links depending on the setup of all external JavaScript files, if two pages are using a file, then the file only need to download once, so the end result speed up page loading.

  

Guess you like

Origin www.cnblogs.com/wangjingzhi/p/12113093.html