1) If I'm already using Modernizr, will I then even need HTML5 Shiv to enable HTML5 tag support for IE?
2) Is HTML5 Shiv only for IE, or for all browser who don't have native HTML 5 support? Like older versions of Firefox, Safari, Chrome, etc?
Modernizr provides an easy way to detect any new feature so that you can take corresponding action. For example, if a browser does not support video feature then you would like to display a simple page.
The HTML5 Shiv enables use of HTML5 sectioning elements in legacy Internet Explorer and provides basic HTML5 styling for Internet Explorer 6-9, Safari 4. x (and iPhone 3. x), and Firefox 3.
We can access various properties of this object 'Modernizr' for feature detection using “Modernizr. featureName”. For example, Modernizr. video will return “true” if the browser supports the video element, and false if the browser doesn't.
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.
1) If I'm already using Modernizer then even will I need HTML5 Shiv to enable HTML5 tag supports for IE.
You don't need to separately include html5shiv, because Modernizr includes it:
As of Modernizr 1.5, this script is identical to what is used in the popular html5shim/html5shiv library.
http://www.modernizr.com/docs/#html5inie
2) and is HTML5 Shiv only for IE or for all browser who don't have native HTML 5 support. like older version of Firefox, Safari, Chrome etc.
It's only for Internet Explorer.
Older versions of other browsers don't need it: http://caniuse.com/html5semantic
And the recommended snippet to include it is:
<!--[if lt IE 9]> <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]-->
Which will only ever run for IE less than 9.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With