0

I am getting script error in loading some web sites.

Please help me how to prevent script error in C# WebBrowser.

This is my code:

try
{
    webBrowser1.Navigate(textBox1.Text);
    while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
    {
        Application.DoEvents();
    }

    MessageBox.Show("Loaded");
}
catch(Exception)
{
    MessageBox.Show("failed");
}
Mat
  • 202,337
  • 40
  • 393
  • 406
user1576034
  • 85
  • 2
  • 5
  • 13

5 Answers5

4

Write this in Your Code

 webBrowser1.ScriptErrorsSuppressed = true;
perilbrain
  • 7,961
  • 2
  • 27
  • 35
1

To disable the script error pop up, you need to go to (in Internet Explorer) Tools->Internet Options, there go to the Advanced tab, and in Browsing select Disable Script Debugging (Other), but, the problem may be related to the fact that every site loaded in the WebBrowser control is rendered in IE7 compatibility mode, to solve this the only thing you can do is a registry hack like this: WebBrowser control to use IE9

Community
  • 1
  • 1
Rafael
  • 2,827
  • 1
  • 16
  • 17
0

change your registry to 2af8 which is IE 11 for devenv.exe software/Microsoft/internet explorer/main/featurecontrol/feature_Browser_emulation

0

If your working with a GUI (like in Visual Studio) just go to the Webbrowser Properties and set "ScriptErrorsSuppressed" = true

0

It is easy to see how this error has been eliminated. But Visual Studio uses Internet Explorer and another Web Browser coding is hard. If you look at the versions, the last Visual Studio one uses IE 11 for WebBrowser tool.

The C++ GUI is recommended for one of each encoding: https://msdn.microsoft.com/en-us/library/60k1461a.aspx

MicroDOS
  • 1
  • 6
  • Here is :Chromium Embedded Framework For WebBrowser C#: https://www.youtube.com/watch?v=zc8abKzvmTg – MicroDOS Apr 28 '18 at 15:19