Changing the emulation mode of the Microsoft Web Browser ActiveX control

I’ve been working on an MFC project which embeds a basic web-browser component in a dialog, in the form of a Microsoft Web Browser ActiveX component. (I know… these are ancient technologies… but sometimes you’ve got to work with what’s available on a project!)

Technically, the control hooks into whatever version of Internet Explorer (IE) you’re running on the system. However, it always seemed to fall-back on IE7 emulation mode for us, meaning a lot of our modern standards-compliant HTML wouldn’t work properly. Thankfully, there is a way to fix this problem, although it’s far from obvious!

Registry value

You can modify this emulation behaviour by adding a registry value, telling the component which version of IE to emulate for a given executable. It can either go under HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER, at the following location:

SoftwareMicrosoftInternet ExplorerMainFeatureControlFEATURE_BROWSER_EMULATION

Add a new DWORD with the same name as your executable (e.g. “myprogram.exe”).

The value of the DWORD identifies which browser version to use:

Desired IE version DWORD value (decimal) DWORD value (hex)
IE7 7000 0x1B58
IE8 8000 0x1F40
IE9 9000 0x2328
IE10 10000 0x2710
IE11 11000 0x2AF8

The trend is pretty obvious here. Presumably IE12 will be 12000 (decimal), and so on. I’d advise against putting in a value higher than you can currently test though, as it could have unexpected side effects in future.

It’s important to note that this only affects the default document mode. If a page contains non-standard quirks, then the browser’s compatibility mode may come into play. That could cause the emulation to drop back to a previous version.

The best way to prevent this is to use up-to-date standards-compliant HTML and CSS.

Limitations

Since the registry key is specified only by the program name (not the path etc.), there is obviously scope for conflicts here. For example, if two different pieces of software both call their main executable “app.exe” then there is no way to distinguish between them in the registry setting. This could be a particular problem if you expect your users to have multiple versions of your software at the same time.

I haven’t found a way round this, so my only advice is to make sure you use unique executable names.

Support on older systems

Older systems such as Windows XP can’t run the more recent versions of Internet Explorer. However, the registry codes above will still work. As far as I can tell, the ActiveX control just uses the latest version of IE it can find, up to and including whatever you specify in the registry setting.

For example, if a user only has IE8 on their system, it won’t cause a problem if you specify the code for IE11 in the registry. The ActiveX control will happily use IE8 instead.

2 comments on “Changing the emulation mode of the Microsoft Web Browser ActiveX control

  1. thanks a lot for this information,
    a small addition from me

    in Windows x64 use:
    HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftInternet ExplorerMAINFeatureControlFEATURE_BROWSER_EMULATION

  2. thanks,

    I’m running a macro with embedded Visual basic in Excel, what would be the application I should add into the register? I’ve tried excel.exe but I still get the error.

    Thanks in advance for your kind help.

Leave a Reply

Your email address will not be published. Required fields are marked *