Found on a website today,The functionality of pages in ie9 and chrome is actually different.So I opened the console under ie9 and found a bunch of js errors. I followed it with fiddler.There is a sentence in the original code:

if (ie) {

Yes, the problem is here:dom exception:invalid_character_err (5)

Because in ie9, some methods have moved closer to the w3c standard.It is consistent with firefox, chrome browser, etc.Include the document.createelement method here.

Therefore, the code here needs to be changed to:

if (ie & version < 9) {
} else {
  var iframe=document.createelement ("iframe");

However, if the meta tag is added to the page,Ability to downgrade the document mode of ie9 to ie7:

<meta http-equiv="x-ua-compatible" content="ie=emulateie7">

This will bypass the bug, but my suggestion is,If there is nothing special on the page that cannot be processed,Don't add such coercion,Will cause some uncontrollable phenomena in normal mode.

Here, I also list a few differences between the different versions of ie in my mind:

1, ie6

a. Does not support png translucent pictures.Can only be implemented with filters

b. max-width, max-height, min-width, min-height of css are not supported

Needless to say,It's a mess, but it still has to be compatible in the project!

2, ie7

a, Solved the problem of support for png translucent images

b. Solved the max-width, max-height, min-width, min-height support of css

c. Solved the bug caused by css float

d. Enhanced the CSS selector. For example, the div node also supports the:hover pseudo-class.

Although it solves many problems of ie6,But ie7 is always an intermediate product,Many times there are confusing style issues,In general,zoom:1 is omnipotent

3, ie8

a, selectors that fully support css2.1,Align with w3c and gradually standardize

b. Removed support for expression in css, and added -ms- private prefix

c, js, support localstorage

d. Since there are many versions,So came up with a ua compatibility mode:x-ua-compatible

4, ie9a, css3 support (partial)

b, html5 support (partial)

But the javascript engine was replaced,Changed to chakra, the performance is great,It also reflects that some dom operations are no longer backward compatible.at this time,ie9 has achieved w3c standardization.

5, ie10

a, css3 and html5 strong support

b, more -ms-private attributes (more private attributes,Will it go awry again?Of course, this is where chrome and firefox take the lead.. . Various private properties! !! !! )

In short, we do the front end,You have to follow the changes,Then adapt to these changes.

  • Previous Teach you to identify simple PHP-free backdoors
  • Next Anatomy of the use of pointers as function parameters in C ++ programming