Menu icon Foundation
Does modernizr need to be in the head?

The foundation 5 documentation still states that Modernizr needs to be added to the section. Now the Modernizr page says "If you don't support IE8 and don't need to worry about FOUC, feel free to include modernizr.js whereever."

IE8 isn't supported anyway and I didn't see any difference in FOUC (none in chrome and FF, a bit but unchanged in IE). So couldn't Modernizr be placed in the bottom of the page as well? Are there drawbacks I'm not aware of?

Reason is, there are tests that need the body element present when running (css-hypenation f.e.) which obviously fail if called in the section.

modernizrcssFoundation 5

The foundation 5 documentation still states that Modernizr needs to be added to the section. Now the Modernizr page says "If you don't support IE8 and don't need to worry about FOUC, feel free to include modernizr.js whereever."

IE8 isn't supported anyway and I didn't see any difference in FOUC (none in chrome and FF, a bit but unchanged in IE). So couldn't Modernizr be placed in the bottom of the page as well? Are there drawbacks I'm not aware of?

Reason is, there are tests that need the body element present when running (css-hypenation f.e.) which obviously fail if called in the section.

Karl Ward about 5 years ago

I moved modernizr to the bottom of body after reading Paul Irish' post about this recommendation. Unless you have some specific reason to keep it in head, then you should move it to end of body also in Foundation pages. It is incredibly unlikely your page will be affected by FOUC unless you are using poor implementation techniques ...

As long as you include it before you run $(document).foundation() ...

Erik Krause about 5 years ago

Many thanks! Note: this forum seems to strip html tags. My post above should read <head> section in both cases.