Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting an error with a web browser control in a WinForms Application

Tags:

browser

c#

.net

I am trying to use a webbrowser control in a winforms app. In my app, when I try to navigate to places that work fine in IE or Chrome, I get a "Script Error" window stating that "An error has ocurred in the script on this page." with "Error: Object doesn't support this property or method." Yet, I can still use IE to get to the page without issue.

What am I missing?

The script error is less important to me than the fact that it is behaving differently in my app than it does in a web browser. My question is this:

Is it possible to embed a web browser in a .Net application that will behave exactly like a stand-alone web browser? How?

like image 369
Andy Stampor Avatar asked Jan 24 '11 19:01

Andy Stampor


2 Answers

For posterity: I know this isn't a proper fix, but you can actually open up Internet Explorer -> Tools -> Internet Options -> Advanced then look under Browsing for the options Disable script debugging (Internet Explorer & Other). Deselect those and you will solve the problem.

Another option is like this:

            webBrowser1.ScriptErrorsSuppressed = true;
like image 180
Danejir Avatar answered Oct 08 '22 03:10

Danejir


IE probably has the error messages turned off. There is likely a script error that needs resolved.

like image 22
Daniel A. White Avatar answered Oct 08 '22 02:10

Daniel A. White