-1

My WinForms project involves a C# web browser control - and I am getting the dreaded scripting error (like this image, different error though) when I visit different webpages:

script error

I have read, and done, all the stuff about updating the browser emulation mode from IE7 to IE9 (or 11) in the windows registry (a la this stuff Use latest version of Internet Explorer in the webbrowser control) and the error still persists.

Now this is really frustrating due to the fact the the web page I am visiting works fine in IE itself, it is just my embedded one that has the error.

In desperation, I renamed my generated exe file "iexplore.exe" and bingo, the app works, with no scripting errors.

So this tells me there must be other settings in the registry or somewhere that cause this error, if anyone knows what these are I'd be most grateful if you could share them please!

N.B. I don't want to suppress the errors, I want to run the script.

Community
  • 1
  • 1
Mickl
  • 88
  • 1
  • 4

1 Answers1

0

Set the WebBrowser.ScriptErrorsSuppressed property to true disable the alerts for errors. Documentation here.

You can also change the IE version used by your WebBrowser as seen here, though I recommend doing this in the installer as editing the registry requires admin permissions.

I would also recommend navigating to http://detectmybrowser.com/ from your WinForms browser to make sure that the changes you made to your registry are correct.

Community
  • 1
  • 1
Bobby Tables
  • 2,953
  • 7
  • 29
  • 53
  • Cheers - however I am not interested in suppressing the errors, I am interested in running the script! And the changes did take effect, I checked that. – Mickl Jan 17 '17 at 10:34
  • @Mickl can you provide a page where you get this happens ? It can be any public link where you get the error message. – Bobby Tables Jan 17 '17 at 10:42
  • What is the exe name of your forms project? see http://www.cyotek.com/blog/configuring-the-emulation-mode-of-an-internet-explorer-webbrowser-control Embed websites will assume the IE Emulation Mode of the top Window in MSIE browsers and WBC apps. you must set that value to 11001. – Rob Parsons Jan 17 '17 at 21:54
  • @robert, sorry, I don't have an example that is publicly available, which I know exhibits this behaviour for sure. – Mickl Jan 18 '17 at 08:45
  • @RobParsons - the IE emulation mode is set to 11001. – Mickl Jan 18 '17 at 08:46
  • @Mickl, unfortunately I don't think there's much I can do to help if I can't reproduce it. One last thing though you did check the console of IE for errors right ? – Bobby Tables Jan 18 '17 at 08:48