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

How to make ie browser a browser that supports html5

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

Share

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

This article focuses on "how to make ie browser a browser that supports html5". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to make ie browser a browser that supports html5".

Nowadays, HTML5 has attracted more and more attention, but browsers that support HTML5 are not mainstream at present, especially nearly 50% of domestic users still use IE6. Since IE9 that supports HTML5 does not support Xp system installation, HTML5 developers will have to consider the issue of downward compatibility for a long time in the future. There are many practices for HTML5 tag or CSS selector compatibility, among which generating tag elements yourself is one.

For the basics, see the following code that works in IE8. The style doesn't work at all.

The code is as follows:

Mxria {color: red;}

Hello!

In order for the browser to recognize the tag and display the effect of the corresponding style, we can add a js as follows, and the effect will be different.

The code is as follows:

Mxria {color: red;}

Document.createElement ("mxria")

Hello!mxria.com

Now you understand the secret of it! Yes, it's document.createElement. HTML5 shiv is such a js plug-in that regenerates all HTML5 tags, you need to load the plug-in, and the HTML5 program can be recognized by all browsers.

Download address: http://html5shim.googlecode.com/svn/trunk/html5.js

Simple usage of trunk/html5.js:

The following is the html5.js file that references Google:

The use of html5shiv is very simple. Considering that IE9 supports html5, you only need to add the following code to the page head:

The code is as follows:

Copy the above code to the head section, and remember that it must be the head part (because IE must know the element before it is parsed, the js file cannot be called elsewhere, otherwise it will be invalidated)

Of course, you can also take out the code and do it for yourself:

(function () {if (! / * @ ccroomonically accurate roomproof raceme 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 (','), ifole.roomthatwhile (iMube -) {document.createElement (e [I])}}) ()

Finally, add this paragraph to the css:

/ * html5*/ article,aside,dialog,footer,header,section,footer,nav,figure,menu {display:block}

The main thing is to make these html5 tags into blocks, like div.

All right, let's keep it simple. It can be summed up in a sentence: quote html5.js to make the html5 tag a block.

At this point, I believe you have a deeper understanding of "how to make the ie browser a browser that supports html5". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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