Reputation: 34188
I've never used HTML5 or CSS3. I am just learning and planning to use them later in a web project. If we just include modernizr js file in page that does not help us to detect which feature works or not rather we need to write code for modernizr fallback system and from there we take decision how to handle situation if any HTML5 feature is not supported by the browser. Here is one modernizr fallback example
Modernizr.load({
test: Modernizr.canvas,
nope: 'http://flashcanvas.net/bin/flashcanvas.js'
});
Please provide your answer with code samples.
looking forward for discussion. thanks
Upvotes: 2
Views: 529
Reputation: 13371
If Modernizr can handle for any browser then why should i use HTML5shiv library?
Why HTML5shiv needs to be included when Modernizr is already used on the page?
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
How HTML5shiv library works? does it solve all IE issues just by including it?
html5shiv only allows IE to recognize and style HTML5 elements. Nothing more.
Does HTML5shiv provide any fallback system?
No, feature detection is only supported by Modernizr. Note that Modernizr by itself doesn't give you fallbacks. You could use yep/nope to provide polyfills or fallbacks to the feature you want to support
How to conditionally load HTML5shiv library if the browser is IE?
using conditional HTML comments, this will load html5shim on IE versions below 9
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
Upvotes: 2