should Modernizr file be placed in head?

后端 未结 4 1146
长情又很酷
长情又很酷 2020-12-23 09:16

Should the reference to the Modernizr JavaScript file be in the head of the page? I always try and place all scripts on the bottom of the page and would like to preserve thi

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-23 09:45

    If you want Modernizr to download and execute as soon as possible to prevent a FOUC, put it in the

    From their installation guide:

    Drop the script tags in the of your HTML. For best performance, you should have them follow after your stylesheet references. The reason we recommend placing Modernizr in the head is two-fold: the HTML5 Shiv (that enables HTML5 elements in IE) must execute before the , and if you’re using any of the CSS classes that Modernizr adds, you’ll want to prevent a FOUC.

提交回复
热议问题