0

I'm writing one simple visualisation app and I have one little problem: webBrowser.Version returns Build: 9600 Major: 11 and despite that I can't use modern CSS3 features to draw circle. Below is HTML code and output I get. I tried various methods found on google and nothing seems to work. Deleted unnecessary code, left only part that is not working in webBrowser.

Oh, btw, it works when opened in standalone IE. Tried also `border-radius: 50%

here is image of what I get

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title>Main Window</title>
    <style>
        .circle {
            border-radius: 10px;
            width: 20px;
            height: 20px;
            background: blue;
        }
    </style>
</head>
<body>
    <div class="circle"></div>
</body>
</html>
jbutler483
  • 24,074
  • 9
  • 92
  • 145
ilmash
  • 174
  • 2
  • 12

2 Answers2

3

This is because the WebBrowser class emulates IE and therefore will have a HKEY setting the version of IE used in the emulation.

Below are a couple of suggestions or alternatives.

Meta Tag

<meta http-equiv="X-UA-Compatible" content="IE=10" />

Add the above to your HTML and it will try and force the browser to show the content in IE10.


HKEY Change on machine

Find the below HKEY's

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

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION

and change or add your App to the values like so

FEATURE_BROWSER_EMULATION "myAppName.exe"=10000

HKEY Change in Code

To do the same as above but within the code, use the following:

RegistryKey registrybrowser = Registry.LocalMachine.OpenSubKey
           (@"SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", true);
        registrybrowser.SetValue("myAppName.exe", 10000, RegistryValueKind.DWord); 
Stewartside
  • 20,378
  • 12
  • 60
  • 81
  • Yeah so you know how OP said despite the webBrowser controls' version property showing Build Major 11... With all these reg hacks will that make the real and not "emulated" version of IE render the CSS3 circle? – Jeremy Thompson Jan 27 '16 at 11:16
  • @JeremyThompson The reported version is just the version installed, not the version used. IE likes to use compatibility mode which then emulates a lower version. Forcing it to use a higher version is one of the very few fixes. – Stewartside Jan 27 '16 at 11:41
  • Nice trick, pity I know it now that ActiveX and IE are dinosaurs, though haven't used a webBrowser in about the same time:) – Jeremy Thompson Jan 27 '16 at 11:46
  • @JeremyThompson https://www.microsoft.com/en-us/WindowsForBusiness/End-of-IE-support IE 11 is now the only supported browser by Microsoft so the hope is that the rubbish old version get phased out pretty quickly. Looking forward to a day where I don't have to battle with IE9 over making things look nice – Stewartside Jan 27 '16 at 11:53
  • @Stewartside: ok, this one works. thanks! I don't know why but under IE11 finally works(I put 11001 in registry) though I already tried also other alternatives like Chromium wrappers and will see how project grows. – ilmash Jan 27 '16 at 14:30
0

I think the WebBrowser is stuck at IE7 or IE8. I tried some of these hacks a few years ago to change its version:

https://weblog.west-wind.com/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version

Also Use latest version of Internet Explorer in the webbrowser control

Community
  • 1
  • 1
stevieg
  • 652
  • 4
  • 14
  • I know this page and already done that. Then, anyway, control itself reports it's version as 11, so hello Internet Explorer my old friend, get updated already – ilmash Jan 27 '16 at 10:29