1

I'm using an HTML5 template that makes thorough use of the semantic tags and includes Modernizr up top to do the necessary IE coaxing. Google PageSpeed is complaining about the blocking JavaScript and recommending a deferred load, but as I understand it Modernizr has to load first to prevent IE from choking. Is PageSpeed wrong about this particular item, or can I push the Modernizr load down to the bottom of the page?

  • Why don't you try to put the loading of the script at the end of the page to make happy Page Speed and see if it even though fixes IE oddities? – Zistoloen Jan 17 '14 at 8:41
7

From Modernizr installation page:

Drop the script tags in the HEAD 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 BODY, and if you’re using any of the CSS classes that Modernizr adds, you’ll want to prevent a FOUC.

Modernizr is pretty fast and lean, especially if you have used their customizer to trim out the features you don't need to use

| improve this answer | |
  • Links please? Is it still relevant in 2019? – Charis Theo Jan 29 at 14:52
0

try this: https://developers.google.com/speed/docs/insights/BlockingJS

or insert async tribute in this javascript

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.