Comments: To enable IE (including IE6) to support HTML5 elements, you must add a simple document in the HTML header. createElement declaration. For details, refer to this article to allow IE (including IE6) to support HTML5 elements. We need to add the following JavaScript in the HTML header, which is a simple document. createElement declaration. This js file is called for IE using conditional annotations. Opera, FireFox, and other non-ie browsers will ignore this code and there will be no http requests.
The Code is as follows:
<! -[If IE]>
<Script src = "http://html5shiv.googlecode.com/svn/trunk/html5.js”> </script>
<! [Endif]->
The above code will only run in IE browser. Note that calling the html5.js file on the page must be added to the Header element of the page, because IE browser must know this element before parsing the element, this js file cannot be called at the bottom of the page.
This html5 js file is provided by the author on the Google code project for direct calls. Of course, if you think this will affect your webpage opening speed, you can download html5 js files and upload them to your server for separate calls.
The following is the code in the html5 js file:
The Code is as follows:
(Function () {if (! /* @ Cc_on! @ */0) return; var e = "abbr, article, aside, audio, canvas, datalist, details, dialog, eventsource, figure, footer, header, hgroup, mark, menu, meter, nav, output, progress, section, time, video ". split (','), I = e. length; while (I-) {document. createElement (e [I]) }}) ()
In addition to calling js files containing the above Code on the webpage to allow IE to support HTML5 elements, you can add the Code directly to the webpage in the following way.
The Code is as follows:
<! -[If IE]>
<Script>
(Function () {if (! /* @ Cc_on! @ */0) return; var e = "abbr, article, aside, audio, canvas, datalist, details, dialog, eventsource, figure, footer, header, hgroup, mark, menu, meter, nav, output, progress, section, time, video ". split (','), I = e. length; while (I-) {document. createElement (e [I]) }}) ()
</Script>
<! [Endif]->