HTML5 has been released impatiently recently. Many people in the QQ group have begun to discuss this new thing. Currently, most browsers do not support HTML5 code. Today, let’s introduce a method to enable browsers to support HTML5.
Since HTML5 has brought more efficient and clean code to our new web pages, the only way to enable IE to recognize those new elements is to use HTML5 shiv. Thanks to remy sharp for providing us with this mini script to solve the problem of IE supporting HTML5.
Use JS scripts to make your website compatible with IE browser.
HTML5 SHIV calls and downloads:
The following is the download address: http://html5shiv.googlecode.com/svn/trunk/html5.js
html5.js must be added to <head></head> and called (because the browser must first interpret this script to parse the subsequent html5 tag, so it cannot be placed at the bottom of the page)The author has placed the js file on the Google code project and allowed everyone to call it directly, of course, the premise is that you don't care about calling the extra file.
You can directly call this js script and use IE conditional comments to call this js file, so that non-IE browsers such as FireFox will ignore this code and there will be no unnecessary http requests. The following code will only run under IE browser:
<!--[ifIE]><scriptsrc=http://html5shiv.googlecode.com/svn/trunk/html5.js></script><![endif]-->
Of course, if you don’t like to call external network files, you can also download them and upload them to your own server to call them separately (the author allows).
Here is the code in the js file:
(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])}})()