2

I've written a WinForms app to open a webbrowser control, and we use this to fill in a form to submit training course events programmatically from a database (it's not perfect, but it saves a lot of time - and no, the company concerned doesn't support XML feeds). However, the system has just started generating script errors, which prevent it working.

I've tried setting:

WebBrowser1.ScriptErrorsSuppressed = True

but this is only partly successful. The good news is that I don't get any script errors, but the bad news is that I can't then log on to the site.

Has anyone got any suggestions? As far as I'm aware the webbrowser control uses IE, so I can't get it to use another browser instead.

Thanks in advance!

2
  • This is a very inefficient way to get in touch with the programmer for that web site. Use the phone to give him a call. Commented Nov 30, 2012 at 17:55
  • Think it's a more general question about IE and script errors, which I get on lots of sites, but don't get with Chrome or Firefox. Commented Dec 1, 2012 at 18:39

1 Answer 1

2

According to the documentation http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.scripterrorssuppressed.aspx if you suppress the errors you also suppress dialog boxes. Meaning Alert Boxes/Authentication used to login will also be suppressed.

Below is what is noted in the documentation:

When ScriptErrorsSuppressed is set to true, the WebBrowser control hides all its dialog boxes that originate from the underlying ActiveX control, not just script errors. Occasionally you might need to suppress script errors while displaying dialog boxes such as those used for browser security settings and user login. In this case, set ScriptErrorsSuppressed to false and suppress script errors in a handler for the HtmlWindow.Error event.

As the documentation states, you can handle the HtmlWindow.Error event to allow dialog boxes, but only suppress scripting errors. (Although, I have been having issues with this actually working correctly.)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.