The browser does not support HTML5 or html5.

Source: Internet
Author: User

The browser does not support HTML5 or html5.

Some browsers do not support new elements in HTML5, such as IE8 or earlier versions. To apply a style, add the following JavaScript code to the header tag 
 1 

The focus is document. createElement. Considering the compatibility of different browsers, You can optimize the above JS Code, that is, using conditional statements to include JS Code

 

IE9 or earlier versions of IE will create HTML5 labels. Non-IE browsers will ignore this code, so there will be no http requests, and the webpage execution efficiency will not be affected.

 1 <script> 2 (function() { 3 if (! 4 /*@cc_on!@*/ 5 0) return; 6 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(', '); 7 var i= e.length; 8 while (i--){ 9 document.createElement(e[i])10 }11 })()12 </script>

Add this section in css:

/* Html5 */article, aside, dialog, footer, header, section, footer, nav, figure, menu {display: block}
These html5 labels are mainly made into blocks, like div.

 

Another way for IE to identify new elements is to use HTML5 shiv. html5shiv is very easy to use. Introduce Google's html5shiv package to Your webpage (you can directly call it after writing it) in the page head.

1 <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>

Must be added to

: Http://html5shiv.googlecode.com/svn/trunk/html5.js

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.