2

Whilst I have read numerous issues pertaining to the WebBrowser control and HTML5, I can't find an answer to this problem.

As the WebBrowser control is stuck in the last century with IE7 it appeared that editing the registry was the only workaround, but as our app is ClickOnce there was a permissions issue. We tried numerous third party controls that gave more grief than they were worth. Fast forward to recently and we discovered that adding

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

to the header of the target site produced perfect bootstrap formatting. :-) Then we got the JavaScript error "Object doesn't support property or method 'attachEvent' " :-( - that seemed odd as the browser was now reporting itself as Edge (tried with ie-11 as well - same result) and I know attachEvent was dropped in favour of addEventListener with IE11...

So it seems to me that even though the page is formatting as though the browser is Edge/IE11 JQuery is still seeing it as IE7 and sending the wrong script. Opening the page directly with IE11 or Edge works as it should..

Any idea what voodoo can be cooked up to overcome this?

Thanks

gchq
  • 1,485
  • 2
  • 23
  • 42
  • I have never used ClickOnce, do you have permission issue writing in HKEY_CURRENT_USER too? – Giangregorio Mar 17 '16 at 10:21
  • It turns out the we are getting the same error even if we do change the registry setting. – gchq Mar 17 '16 at 14:10
  • Pay attention that if you are using a 32bit app in a 64bit os you must use Wow6432Node. – Giangregorio Mar 17 '16 at 18:50
  • We set this in HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION and it has the same effect as setting the meta tag on the site - bootstrap formatted correctly, same JavaScript error! – gchq Mar 18 '16 at 01:09
  • Try [this code](http://stackoverflow.com/a/18333982/1768303). – noseratio Mar 18 '16 at 02:23
  • Hi Noseratio - tried that, it added the registry settings for the application but still the same JavaScript error – gchq Mar 18 '16 at 12:41
  • Did you ever find a solution to this? I have the same issue when I try to embed the browser in Delphi and I want to open a page the references some JavaScript files. – costa Apr 09 '16 at 07:03
  • @gchq: As per Noseratio's answer, I created a C# app that called the SetBrowserFeatureControl, I set the fileName variable to the name of my Delphi exe, run the app, then run the Delphi app and the whole thing started to work without giving me that dreaded error. – costa Apr 09 '16 at 07:19
  • We started to use CefSharp Chromium. It doesn't play very well with PDF's in a bootstrap modal but other than that renders HTML5 as well as any other modern browser – gchq Apr 09 '16 at 19:02

0 Answers0