Where to place JavaScript in an HTML file?

前端 未结 12 2233
萌比男神i
萌比男神i 2020-11-22 04:30

Say I have a fairly hefty JavaScript file, packed down to roughly 100kb or so. By file I mean it’s an external file that would be linked in via

12条回答
  •  鱼传尺愫
    2020-11-22 05:07

    The Yahoo! Exceptional Performance team recommend placing scripts at the bottom of your page because of the way browsers download components.

    Of course Levi's comment "just before you need it and no sooner" is really the correct answer, i.e. "it depends".

提交回复
热议问题