- Feb 1, 2021
- 35
- 7
- 8
- Customer Identifier
- E074775
Background
The XbpHTMLViewer class internally uses an instance of Microsoft's Webbrowser control for hosting content. This basically is a wrapper around an Internet Explorer instance.Prerequisite: Microsoft Internet Explorer must be installed on the client machine.
The Webbrowser control was designed an in-application browser engine, and hence has a different target audience than the regular IE browser. This leads to some compatibility and usability issues, some of which are outlined below.
Content is hosted in IE compatibility mode
By default, the Webbrowser control operates in IE7 compatibility mode. As a restult, pages may be displayed incorrectly, and/or JavaScript errors may occur. IE7 compatibility mode effectively prevents applications from using modern content with HTML/CSS and JavaScript!In order to get around this problem, a Registry key must be created which selects the correct browser compatibility on an application (.EXE)-level.
(32 Bit operating system)
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION
(64 Bit operating system)
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION
The FEATURE_BROWSER_EMULATION Registry key contains a list of DWORD values specifying the desired browser compatibility mode for an application (.EXE) identified via the name of the sub-key.
Example:
FEATURE_BROWSER_EMULATION
erpapp.exe = 0x2710 (DWORD) // Display web content in "erpapp.exe" using IE10 default mode
Therefore, in order to use modern web technologies in an Xbase++ application via XbpHTMLViewer, the application's .EXE file name must be added to the Registry with the required browser mode. See here for a list of supported values for the FEATURE_BROWSER_EMULATION Registry key.
JavaScript errors may throw error dialogs
JavaScript errors are not normally displayed to the user by the Internet Explorer browser. Instead, such errors are listed only in the JavaScript console (developer tools). The Webbrowser control behaves differently, however. Here, every JavaScript error results in the display of an error dialog, which several impacts the user experience. In order to get rid of the annoying error dialog, an internal property can be set to suppress all secondary dialogs in the Webbrowser control.
Xbase++:
oBrowser := XbpHTMLViewer():new( oParent )
oBrowser:silent := .T. // Suppress error dialogs in the HTML viewer
oBrowser:create( ... )
...