Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I was toying with the idea of switching to html5. It seems there are 2 major scripts for dealing with supporting html5 on older browsers.

Modernizr and Html5Shiv

I was wondering if they do the same thing. Which one to choose and why?

Any ideas?

share|improve this question

3 Answers 3

up vote 7 down vote accepted

Modernizr is used to check the availability of HTML5 features in different rendering engines. It includes a script like Html5Shiv, which (only) enables HTML5 tags on Microsoft Internet Explorer (prior to version 9, which knew HTML5). See also "How to get HTML5 working in IE and Firefox 2".

If you just want to enable HTML5 for IE < 9, then Html5Shiv would be sufficient. I'm using the Html5Shiv version by Remy Sharp within a MS conditional comment:

<!--[if lte IE 8]>
    <script src="templates/js/html5.js"></script>
<![endif]-->

If you also want to check (via CSS or JS), if the clients browser is capable of e.g. HTML5-form-elements (like Operas date input), CSS3 columns or gradients, then use Modernizr.

share|improve this answer

You might also want to check out html5boilerplate.com, a good resource for starting with html5 sites, they provide toggleable choices like html5 shiv or modernizr along with many other baseline improvements.

share|improve this answer
    
yes html5boilerplate is good. It has a choice for modernizr or html5shiv. But which one to include? –  Sinan Apr 6 '11 at 18:07
    
fair enough, I guess html5 is what prompted the question? –  Kzqai Apr 6 '11 at 20:23

I know this is from a while back, but I felt I should add that modernizr doesn't appear to polyfill HTML5 elements that are loaded via AJAX - it only works on content that was present on initial page load. Html5Shiv DOES work on content loaded via AJAX, but it's also only a small subset of modernizr's feature set. We're actually using both on the web app I'm working on.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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