HTML5 support on older browsers

I was reading something about using JavaScript to allow support for HTML5 in older browsers. THe article has this code, but I don’t understand what it does or where it goes…

<!--[if lt IE 9]>
  <script>
    document.createElement("header" );
    document.createElement("footer" );
    document.createElement("section"); 
    document.createElement("aside"  );
    document.createElement("nav"    );
    document.createElement("article"); 
    document.createElement("hgroup" ); 
    document.createElement("time"   );
  </script>
  <noscript>
     <strong>Warning !</strong>
     Because your browser does not support HTML5, some elements are created using JavaScript.
     Unfortunately your browser has disabled scripting. Please enable it in order to display this page.
  </noscript>
<![endif]-->
1 Like

Thanks!!

IE8 doesn’t recognise any of the new html5 elements and won’t apply styling to them by default unless you first create them with javascript. You should use the html5shiv for this as that is what it is designed for and will contain the full list of new elements.

4 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.