Thursday, April 15, 2010

Enabling HTML5 in IE

If you have read my previous article "About HTML5" and gone through those links and seriously read those tutorials and articles about HTML5, then by now you should be able to make web page using HTML5. Some may have already started experimenting and found its not rendering  properly in IE. Here is small tip for those geeky ones who act than simply read and forget.

You may have noticed in HTML5 there are many new elements like < header>,<section>,<article> etc and the only way to acknowledge these new elements to IE is to use John Resig  HTML5 shiv technique.Using that technique, Remy Sharp has created an excellent mini script (html5.js) that enables all the new elements.

It is very easy to use, simply put the following code in the head element (this is because IE needs to know about the element before it comes to render them - so it can't sit in the footer of the page, i.e. below the elements in question. ). Also Its better to wrap it in an IE conditional call to reduce the http pulls for other browsers.
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

Hope that was useful!

No comments: