atxgeek 


just one more geek in a sea of austin techies

August 29, 2011

IE9 compatibility (IE9 fails on my website, or vice versa)

Recently I was informed that an older .Net--based website I still handle the technicals for was failing to render properly within Internet Explorer 9.  This surprised me because (a) IE9 is regularly touted as being the version of Internet Explorer that's closer than ever to published standards, and (b) the website in question rendered perfectly in the latest versions of Firefox and Chrome as well as in IE7 and IE8 (I've already put IE6 to bed with regards to compatibility testing).  My solution ended up being a simple one line addition...

The solution was to simply specify a default compatibility mode for an earlier version of Internet Explorer.  You can read up on the options here, but the solution I used was a one-line addition (in yellow, below) to the WEB.CONFIG file:


  <configuration>
    <system.webServer>
      <httpProtocol>
        <customHeaders>
          <add name="X-UA-Compatible" value="IE=8" />
        </customHeaders>
      </httpProtocol>
    </system.webServer>
  </configuration> 
That's it.  Add the line, save WEB.CONFIG and the change is immediate. 

An interesting side note:
You can specify a series of versions to regress to which effectively allows you to *skip* rendering for a specific version of IE by leaving that version out of the regression chain.  For instance, you could specify "IE=8, IE=6" which would then skip IE7 compatibility rendering for browsers that didn't support IE8 rendering but did support IE7 and IE6 rendering.  I've never needed to do this but it's nice to know the option exists.

No comments:

Post a Comment