Better browser support for Control Add-ins in Dynamics NAV

Microsoft Dynamics NAV uses a .NET web browser control to display Javascript control add-ins. This is great, but .NET by default chooses to use a rather ancient version of Internet Explorer (IE7?) to handle this. This creates, in some cases, an less than optimum  user experience.

The problem becomes even bigger, when an installation has both RTC and web clients. In that case user could get different functionality from control add-ins due to different versions of IE used.

To fix it, a registry key must be added to all client machines running the role tailored client.

This piece of code will add the required registry key to the users machines and allow NAV to use the newest version of IE. All varibles MUST be “RunOnClient”, otherwise you will just be setting registry keys on the service tier server.

This code set the required IE version to 0 –  If you want a specific IE version, check this

IF Environment.Is64BitOperatingSystem THEN
  RK := RK.OpenBaseKey(RegistryHive.CurrentUser,RegistryView.Registry64)
ELSE
  RK := RK.OpenBaseKey(RegistryHive.CurrentUser,RegistryView.Registry32);

RK2 := RK.OpenSubKey('SOFTWARE\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION', RegistryKeyPermissionCheck.ReadWriteSubTree);
IF ISNULL(RK2) THEN BEGIN
  RK2 := RK.CreateSubKey('SOFTWARE\\Microsoft\\Internet Explorer\\Main\\FeatureControl', RegistryKeyPermissionCheck.ReadWriteSubTree);
  RK2 := RK.CreateSubKey('SOFTWARE\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION', RegistryKeyPermissionCheck.ReadWriteSubTree);
END;
RK2.SetValue(Process.GetCurrentProcess().ProcessName + '.exe', 0, RegistryValueKind.DWord);
RK2.Close();
RK.Close();

Here is the code as a  NAV2016 codeunit – Download it if you like better webbrowser with addins

Share thisShare on FacebookTweet about this on TwitterShare on RedditShare on Google+Share on LinkedIn

3 thoughts on “Better browser support for Control Add-ins in Dynamics NAV”

Leave a Reply