html5 for lte IE8

Discuss general web development questions. Help others and get help from others.

Moderator: kfury77

html5 for lte IE8

Postby mapleleaf » Tue Apr 26, 2011 12:12 am


For those of you interested here is a JavaScript function that will give lte IE8 html5 elements
Code: Select all

<!--[if IE]>
<script>
(function(){
var html5elments = "address|article|aside|audio|
canvas|command|datalist|details|dialog|
figure|figcaption|footer|header|hgroup|
keygen|mark|meter|menu|nav|progress|
ruby|section|time|video".split('|');
for(var i = 0; i < html5elmeents.length; i++){
document.createElement(html5elments[i]);
}
}
)();
</script>
<![endif]-->


Place the above code just above the closing head element in your html.

Previously, I had mentioned the following code that will accomplish the same result. Which method IF you choose to use is entirely your choice.
In either case, you MUST have the following doctype declared
<!DOCTYPE html>

Code: Select all
<!--[if IE]>
          <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 simulated using JScript.
             Unfortunately your browser has disabled scripting. Please enable it in order to display this page.
          </noscript>
   <![endif]-->

User avatar
mapleleaf
 
Posts: 121
Joined: Thu Oct 14, 2010 2:21 am
Location: Ashcroft, BC Canada

Return to Web Developer Talk

Who is online

Users browsing this forum: No registered users and 10 guests