Home  >  Article  >  Web Front-end  >  Solution to IE supporting HTML5_html5 tutorial tips

Solution to IE supporting HTML5_html5 tutorial tips

WBOY
WBOYOriginal
2016-05-16 15:51:201457browse

Since HTML5 is getting more attention for bringing more efficient and cleaner code to our new web pages, however the only way to make IE recognize those new elements (such as

) is to use HTML5 shiv, thanks to remy sharp for us This mini script is provided to solve the problem of HTML5 support in IE.

Use and download
HTML5.js must be called within the head element of the page (because IE must know this element before the element is parsed, so this js file cannot be called at the bottom of the page.)
The author has Put the js file on the Google code project and allow everyone to call it directly. Of course, the premise is that you don't care about calling additional files.
http://html5shiv.googlecode.com/svn/trunk/html5.js
You can use IE conditional comments to call this js file, so that non-IE browsers such as FireFox will ignore this code. There will be no unnecessary http requests. The following code will only run under IE browser:


Copy the code
The code is as follows:



Of course, if you don’t like to call external network files, you can also download it and upload it to your own server to call it separately (author’s permission) .

The following is the code in the js file:

Copy the code
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])}})()
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn