How to determine if a javascript was already loaded by other html file

后端 未结 3 2017
小蘑菇
小蘑菇 2021-01-22 23:43

How to determine if a javascript was already loaded by other html file? I want to reduce the redundant loading of the javascript files to decrease the loading time of my webpage

3条回答
  •  [愿得一人]
    2021-01-23 00:38

    If your web server is providing correct caching headers this shouldn't be necessary, the browser will cache the javascript file across multiple requests.

    You might want to check out the YDN page Best Practices for Speeding Up Your Web Site

提交回复
热议问题