A few days ago, Microsoft had done a low-key launch of IE8, which means you need to make your applications compatible with 3 differently broken version of IE ;-P. The biggest challenge IE8 poses is that it runs in "strict" mode by default, which coincidentally breaks all of the previous IE6/7 hacks that had to put in place to make CSS and Javascript render in IE the same way they do in other browsers.
Fortunately, unless you wish to refractor your entire code to support IE8 strictness, MS did add a "compatibility" switch, via the X-UA-Compatible meta-tag or header, if you change its value to "IE=EmulateIE7" it makes it emulate the "strict" mode ala IE7, which at least in all of our code makes it render things properly. However, there is a "slight" problem, which I discovered while trying to implement this function.
According to the docs, you can trigger this behavior via the following meta tag:
CODE:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
, unfortunately it didn't work and according to the IE8's developer tool the default strict mode of IE8 was still being used. No matter the value, be it IE=IE7 or IE5 or EmulateIE7, it would just be ignored. Eventually, I realized that perhaps the DTD is the problem, our pages use XHTML/Transitional DTD, (
CODE:
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
), which means custom meta tags are effectively spec violations. Which, as far as I can tell IE8 in it's strict mode happily ignores, Catch 22!. This is despite a nice note inside
MSDN Blog that says:
CODE:
NOTE: The X-UA-Compatible tag and header override any existing DOCTYPE.
The solution, is to set the X-UA-Compatible value via an HTTP header ala:
PHP:
<?php
header('X-UA-Compatible: IE=EmulateIE7');
?>
This means the parameter is outside of HTML and will get properly captured by IE, in our case that solved all of the JS and CSS issues that appeared in IE8. For those of you using ExtJS date picker, this does solve the cut-off of the calendar window.
www.thelinuxblog.co.cc on : PingBack