Log in

No account? Create an account
Previous Entry Share Next Entry
Compatibility Settings and Internet Explorer

Recently I've been having to deal with IE and its compatibility modes. This has been a blast! Consider all of these factors:

  • Webpage is loaded within a WebBrowser control (as provided by Windows Forms or the like)
  • Page should support IE 9, 11, with emulation option for 7
  • Support ActiveX object events for IE 7 and IE 11 style hookups

There are a number of ways to dictate how IE should be rendering a page, here are a few.

  • Meta tag
  • Doc Type
  • IE Intranet compatibility setting
  • Registry Key

There are other ways of telling IE how it should render a page, but are the main ones when dealing with a browser control. I've ordered them by precedence, but the Registry Key can override the Doc Type.

  • The browser version IIS was told to load the page for.
  • The document mode the browser actually loaded the page for.

It would be really nice if you could render your page in IE 11 Edge if you're in a version 11 browser. You can, but any logic which depends on the browser version must be placed within Javascript and IIS version checks must be thrown out. Here are some things to keep in mind about these configurations.

The browser control is "perpetually stuck in IE 7 rendering mode." This means IIS will always be told to render in IE 7 unless otherwise specified. And this is specified in the Windows Registry. For debugging, be sure to follow the instructions about add the vshost executable when running with Visual Studio debugging (if you don't match the executable name exactly it won't use that entry, and for some reason I kept wanting to use vhost). Which this does not matter if IIS is not the one producing code for IE 7 or IE 11 (where that code is unsupported on the other version).

For some reason all of these different places make it so complicated to understand where the bug resides. Hopefully this helps others or my future self.