Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the way to make browsers below IE9 compatible with HTML5

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

How to make the following version of IE9 browser compatible with HTML5, many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.

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.

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:

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.

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])}) ()

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report