Wednesday, 13 July 2011

HTML 5 support for all non supported IE browsers or HTML5 in IE

Many of time you have seen that few HTML 5  tags are not supported by Internet Explorer. The solution for this is only <script> tag.

The <script> tag is very useful to define client side script but in this code I used it for only to make my Internet Explorer compatible to represent HTML5  tags.
To work with html5 tags in IE write the following code in <script> tag in header section.
<script type="text/javascript">  
document.createElement('nav');
document.createElement('menu');
.........................
.........................
</script>

Like the above what are the tags you want use just write single statement for each tag. or write as below
<!--[if IE]>
<script type="text/javascript">
var html5elements =
"menu,nav,output,progress,section,time,video,...........etc".split(',');
for (var i = 0; i < html5elements.length; i++)
document.createElement(html5elements[i]);
</script>
<![endif]-->

No comments:

Post a Comment