Get the App
SLTechnology News&Howtos  ›  Development  › 

How to make browsers below IE9 compatible with HTML5

Shulou Source: shulou.com Published: 2022-06-01 07:01:55 10月03日 Update

This article mainly introduces "how to make browsers below IE9 compatible with HTML5". In daily operation, I believe many people have doubts about how to make browsers below IE9 compatible with HTML5. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "how to make browsers below IE9 compatible with HTML5". Next, please follow the editor to study!

For 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 that invokes the js file against IE with conditional comments. Other non-IE browsers such as Opera,FireFox will ignore this code and there will be no http requests.

Copy the code

The code is as follows:

The above code will only run under the IE browser, and it should be noted that calling the html5.js file in the page must be added to the head element of the page, because the IE browser must know the element before parsing, so the js file cannot be called at the bottom of the page.

The js file of html5 is provided by the author on Google code project and can be called directly. Of course, if you feel that this will affect the opening speed of your web page, you can download the js file of html5 directly and upload it to your own server.

The following is the code in the js file of html5:

Copy the code

The code is as follows:

(function () {if (! / * @ ccroomonically accurate roommates beat 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 (','), idetecte.roomthsit while (I -) {document.createElement (e [I])}) ()

In addition to calling the js file containing the above code in the web page to make the IE browser support the HTML5 element, you can also add the code directly to the web page in the following way.

Copy the code

The code is as follows:

(function () {if (! / * @ ccroomonically accurate roommates beat 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 (','), idetecte.roomthsit while (I -) {document.createElement (e [I])}) ()

At this point, the study on "how to make browsers below IE9 compatible with HTML5" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Code browser browsing files elements version learning web pages pages more help support utility next author header bottom article way method Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology MySQL Shulou Information macOS Redmi