Where to place JavaScript in an HTML file?

前端 未结 12 2358
萌比男神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:11

    Like others have said, it should most likely go in an external file. I prefer to include such files at the end of the . This method is more human friendly than machine friendly, but that way I always know where the JS is. It is just not as readable to include script files anywhere else (imho).

    I you really need to squeeze out every last ms then you probably should do what Yahoo says.

提交回复
热议问题