Question

I'm running the full development version of Modernizr on my site, and while html5shiv is included in Modernizr, it doesn't seem to be running. If I add html5shiv as a separate script to the page, everything works great. The rest of Modernizr is working fine, too. Do I have to initialize the html5shiv in Modernizr somehow? The docs make it seem like it automatically runs.

Here's the code at the head of my page:

<script src="/assets_site/js/head.load.min.js"></script>
<script>
  head.js(
    { modernizr: '/assets_site/js/modernizr.js' },
    { jquery: '//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' },
    { placeholder: '/assets_site/js/jquery.placeholder.min.js' },
    { response: '/assets_site/js/jquery.response.min.js' }
  );
</script>

And the separate html5shiv code that's been working where Modernizr hasn't:

<!--[if lt IE 9]>
  <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

Dumb question, but I'm rather puzzled. Thanks.

Was it helpful?

Solution 2

Ah, figured it out. The problem was that I'm a blockhead.

The html5shiv was loading fine in Modernizr, but I also had respond.js set to run inside that conditional IE snippet. When I removed the html5shiv script, I removed respond.js along with it, which caused the layout to go bonkers. I was completely ignoring the media queries part and assumed it was a html5 problem.

Mystery solved (though it's no mystery that I'm a blockhead).

OTHER TIPS

2 things:

  1. have you checked that the shiv is included in your download? http://modernizr.com/download/
  2. where in your document are you loading modernizr.js? It may be necessary to load it in the head rather than at the bottom of the page.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top