Today found a Web site, IE9 and Chrome page features incredibly different, so in IE9 open console, found a pile of JS error, with fiddler tracking a bit, the original code has a sentence is such:
if (IE) {
var iframe = document.createelement (' <iframe src= ' http://www.jb51.net "></iframe> ');
}
Yes, here's the problem:DOM exception:invalid_character_err (5)
because in IE9, some methods have been aligned to the standards of the consortium, and Firefox, Chrome, etc. are consistent, including the Document.createelement method here.
So the code here needs to be changed to:
if (ie && version < 9) {
var iframe = document.createelement (' <iframe src= "http://www.jb51.net" > </iframe> ');
else {
var iframe = document.createelement (' iframe ');
Iframe.setattribute (' src ', ' http://www.jb51.net ');
}
However, if this meta tag is added to the page, the IE9 document mode can be forcibly demoted to IE7:
<meta http-equiv= "x-ua-compatible" content= "Ie=emulateie7" >
This can bypass the bug, but my suggestion is that if there is nothing special on the page can not handle, do not add such coercion, will lead to some normal mode of uncontrollable phenomenon.
Here, I also drop a few different versions of IE in my impression:
1, IE6
A, PNG translucent image is not supported, only filter can be used to implement
b, do not support CSS max-width, max-height, Min-width, Min-height
Others needless to say, a mess, but the project still have to be compatible!
2, IE7
A, resolution of the PNG translucent image support issues
b, to solve the CSS max-width, max-height, Min-width, min-height support
c, solve the CSS float caused by the bug
D, enhanced CSS selector, for example, div node also support: hover pseudo class
Although solved IE6 many problems, but IE7 is always an intermediate product, many times will appear lets the person not be able to touch the mind the style question, under normal circumstances, Zoom:1 is the omnipotent
3, IE8
A, fully support the css2.1 selector, to the same as the consortium, and gradually standardize
b, remove the support of expression in CSS, and increase the private prefix of-ms-
C, JS aspect, support Localstorage
D, due to the number of versions, so a UA compatibility mode: x-ua-compatible
4, IE9
A, CSS3 support (part)
B, HTML5 support (part)
But the JavaScript engine was replaced with chakra, and the performance was great, and it reflected that some DOM operations were no longer backward compatible. At this point, IE9 has already standardized the consortium.
5, IE10
Strong support for a, CSS3 and HTML5
B, more-ms-private properties (private property After more, will not go again?) Of course, this is the Chrome and Firefox take the lead to deviation ... Various private properties!!! )
In short, we do the front end, we have to follow the change, and then to adapt to these changes.