Selerix Developer Tools
Rendering Issues using WebBrowser Control in Windows
Supplemental Information > Rendering Issues using WebBrowser Control in Windows

If you are experiencing rendering issues while integrating a BenSelect enrollment within your custom Windows application using the WebBrowser control, the solution to your problem may be to modify Internet Explorer's default document mode.  This override has existed since Internet Explorer v6 and allows you to define how IE should handle your application.  Amongst other things, this allows you to specify an Internet Explorer compatibility mode for your application, forcing the browser to function as it did in an earlier version.

 

Sample story

An application that uses the WebBrowser control to embed a BenSelect enrollment within a client window, EnrollmentFestival.exe, works as expected on systems running Internet Explorer v11, but does not look right on later versions of the browser.  To force Internet Explorer to work as it did by default in v11, create a new DWORD (32-bit integer) registry key here:

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION

By setting the Name to the file name of the executable,  EnrollmentFestival.exe, and the value to 11000 in decimal, or 2AF8 in hexadecimal, when the WebBrowser control is accessed from EnrollmentFestival.exe, it will emulate the default document mode used by Internet Explorer v11.  That is, it will display web pages that contain standards-based !DOCTYPE directives in the same manner as IE v11.

Technically, adding the registry entry under any of these keys should have the same effect:

 

Possible values and their meaning

    Note:  This list will likely change.  Check with msdn.com for the latest FEATURE_BROWSER_EMULATION values.

Decimal Value Hex Value Description
11001 2AF9 Internet Explorer 11. Webpages are displayed in IE11 edge mode, regardless of the declared !DOCTYPE directive. Failing to declare a !DOCTYPE directive causes the page to load in Quirks.
11000 2AF8 IE11. Webpages containing standards-based !DOCTYPE directives are displayed in IE11 edge mode. Default value for IE11.
10001 2711 Internet Explorer 10. Webpages are displayed in IE10 Standards mode, regardless of the !DOCTYPE directive.
10000 2710 Internet Explorer 10. Webpages containing standards-based !DOCTYPE directives are displayed in IE10 Standards mode. Default value for Internet Explorer 10.
9999 270F Windows Internet Explorer 9. Webpages are displayed in IE9 Standards mode, regardless of the declared !DOCTYPE directive. Failing to declare a !DOCTYPE directive causes the page to load in Quirks.
9000 2328 Internet Explorer 9. Webpages containing standards-based !DOCTYPE directives are displayed in IE9 mode. Default value for Internet Explorer 9.
 
Important  In Internet Explorer 10, Webpages containing standards-based !DOCTYPE directives are displayed in IE10 Standards mode.
8888 22B8 Webpages are displayed in IE8 Standards mode, regardless of the declared !DOCTYPE directive. Failing to declare a !DOCTYPE directive causes the page to load in Quirks.
8000 1F40 Webpages containing standards-based !DOCTYPE directives are displayed in IE8 mode. Default value for Internet Explorer 8.
 
Important  In Internet Explorer 10, Webpages containing standards-based !DOCTYPE directives are displayed in IE10 Standards mode.
7000 1B58 Webpages containing standards-based !DOCTYPE directives are displayed in IE7 Standards mode. Default value for applications hosting the WebBrowser Control.

 

Sample code to change registry manually

A developer who ran into issues when integrating a BenSelect enrollment in his application provided Selerix with the VB.NET code below which resolved his issue.  It uses the FEATURE_BROWSER_EMULATION feature control registry entry to force emulation of Internet Explorer v10.  Thanks Lee!

Dim b As WebBrowser

Try

  b = New WebBrowser()

  Dim browserVersion As Integer

  browserVersion = b.Version.Major * 1000

 

  Dim reg As Microsoft.Win32.RegistryKey

  Dim path As String

  path = SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION"

  reg = Microsoft.Win32.Registry.LocalMachine.CreateSubKey(path)

  reg.SetValue("PCIEnrollerSupport.exe", browserVersion)

  reg.SetValue("PCIEnrollerSupport.vshost.exe", browserVersion)

Catch ex As Exception

 

End Try

 

See Also