Checking browser version in IE8

IE8 comes with an "Emulate IE7" button, which will revert the page back to run as IE7. This is great for developers who can quickly test their apps in both versions (I just wish we could have an IE6 button too!).

Furthermore you can place a tag in the page that will force IE8 to render the page as IE7 would have. However this poses a problem. Lets say you make some javascript that takes IE8 into account with version checking, but the page has this IE7-compatibility tag embedded. The JavaScript browser version check would still report v8. Instead for IE you should use 'document.documentMode' to get the version number. That means that if you set your browser to run as IE7, this would return version 7 (even though it really is 8), and if you set in quirks mode, you will be getting v5. It would be safer to adjust your javascript using this property.

I ran some few tests on the fresh IE8 beta1. It still looks pretty much like IE7. This blog runs with only one minor problem. I have a gallery page that relies on AjaxControlToolkit, and this really broke on IE8. Hopefully the AjaxControlToolkit team will quickly get all those issues fixed.

There are 4 IE8 specific sessions at the Mix conference. Keep an eye on them at the Mix Website when they come online (about 24 hours after the session):

  • BCT08 - Welcome to Internet Explorer 8  Wed March 5 at 1:30 PM to 2:45 PM
  • CT07 - Cross-Browser Layout with Internet Explorer 8  Wed March 5 at 3:00 PM to 4:15 PM
  • T21 - Integrating Your Site With Internet Explorer 8  Thursday March 6 at 8:30 AM to 9:45 AM
  • T04 - Developing Cutting Edge Web Applications With Internet Explorer 8  Friday March 7 at 8:30 AM to 9:45 AM
  • Here's a picture from the first session, showing the Acid2 test:

    Comments (6) -

    • It's not really fair to submit browsers to this, since it tests CSS3 and a lot of ECMA script as well. IE8 implements CSS2.1, and the ACID2 test is good for this, although it only tests a subset of it all.
    • But CSS3 is still not completed. By implementing an uncomplete spec in the most used browser. we risk making things worse. Didn't we learn anything from the current mess we are in?
      We need standard compliance, and that doesn't mean implementing a standard that potentially could change after a release. I don't really see the point in being the very first anyway (but of course not as slow as MS have been this time). It will take years before we can fully rely on CSS2.1 compliance, since FireFox 1.5+2 and IE6+7 will be around for many years to come.

      Another thing that Microsoft learned was that the W3C specifications are often too vague, and they had to create a test suite far more extensive than the ACID2 test and try to get to agreement with the other browser vendors on these tests. This would be required for CSS3 too, and making a test suite for an incomplete spec is a vaste of time (if not impossible) IMHO.
    • ... hopefully they included only requirements which are already completed ... and have to be tested. Then it is probably a very good idea to have such a test before standard is fully developed - browser developers will still have a change to influence on it if they will find some features hard to implement, badly designed, etc. It sounds like a good TDD principle to me. I'd prefer to have a new standard based on something that works and well tested and not only formally accepted without real implementation.
    • WebKit has 100%, and has had since March 26th, two days after your comment...

      (I notice that IE8 bungles the webkit site - wheras its fine on most others. Intereting.)

    Add comment