Ways to allow IE browsers to support HTML5 standards

Source: Internet
Author: User
Tags html header split

Since the HTML5 standard has received a lot of attention, and as the world's most users of Internet Explorer can support the HTML5 standard is also a matter of concern, Microsoft last week in the technical assembly that Microsoft is currently developing the IE9 will be more support HTML5 standards, But Microsoft is a bit vague about whether IE9 will fully support all of HTML5 's standards. The HTML5 standard can bring more efficient and cleaner code to the Web page, only Microsoft participates in the HTML5 design work, can let IE browser identify more new elements.

The HTML5 standard is expected to be released to the world in 2022, although it is now about 3 years from the date of his release, but I think it is not so far away from us, and many Web sites are currently designed and developed to adopt HTML5 standards. In the formulation and promotion of HTML5 standards, Apple, Google, Opera and Mozilla, and other well-known browser manufacturers are more active, Microsoft is also beginning to pay, from last week Microsoft in the technical conference released IE9 details, Microsoft will take a cautious approach to the web standards. Microsoft has also said: IE browser will be the core of the standard HTML5. But Microsoft's latest browser IE8 and the following IE version of the HTML5 tag support is limited, we can add a script in the Web page to solve the current IE browser to HTML5 support problems.

To allow IE (including IE6) to support the HTML5 element, we need to add the following JavaScript to the HTML header, which is a simple document.createelement declaration, using conditional annotations for IE to invoke this JS file. Opera,firefox and other non-IE browsers will ignore this code, and there will be no HTTP requests.

<!--[If ie]>
<script src= "Http://html5shiv.googlecode.com/svn/trunk/html5.js" ></script>
<! [endif]-->

The above code will only run in IE browser, there is one point to note that the call Html5.js file in the page must be added to the head element of the page, because IE browser must know the element before parsing, so this JS file can not be called at the bottom of the page.

This HTML5 JS file is the author put him on Google Code project to provide you can directly call, of course, if you think this will affect the speed of your Web page, you can html5 the JS file directly downloaded down to upload to their own server to call alone.

The following is the code in the HTML5 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])}}) ()

In addition to calling JS files that contain the above code in a Web page to allow IE browsers to support HTML5 elements, you can add the code directly to the Web page in the following way.

<!--[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]-->

IE Development Manager Aidrien-Batmain Adrian Bateman said that the IE team wanted to share their views on HTML5 and participate in the discussion of the standard. Batman said that while the IE team is more of a problem than a solution, open discussion is the best way to drive HTML5 development. It is believed that whether IE browser can continue to support the HTML5 standards, the HTML5 standard is widely used in the world is the trend.

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.