Click here to Skip to main content
15,665,004 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I had developed web browser, which one is used for 'https' sites. but during load the site some script error message is pop up is came. for that problem i used
C#
WebBrowser1.ScriptErrorsSuppressed = true;

then my https site doesn't load.
then i used below codings,
C#
 // Hides script errors without hiding other dialog boxes.
private void SuppressScriptErrorsOnly(WebBrowser browser)
{
  // Ensure that ScriptErrorsSuppressed is set to false.
  browser.ScriptErrorsSuppressed = false;

  // Handle DocumentCompleted to gain access to the Document object.
  browser.DocumentCompleted +=
    new WebBrowserDocumentCompletedEventHandler(
      browser_DocumentCompleted);
}

private void browser_DocumentCompleted(object sender, 
  WebBrowserDocumentCompletedEventArgs e)
{
  ((WebBrowser)sender).Document.Window.Error += 
    new HtmlElementErrorEventHandler(Window_Error);
}

private void Window_Error(object sender, 
  HtmlElementErrorEventArgs e)
{
  // Ignore the error and suppress the error dialog box. 
  e.Handled = true;
}

but also am getting that popup script error.

But my need that script error popup is suppressed like in IE(The script error shown in status bar icons).

Please help me...!
Thanks in advance...!
Posted
Comments
Maarten Kools 4-Feb-14 1:31am    
Sounds to me you just have to fix the script error. Suppressing it will just make sure you don't get notified of errors, but if the error causes the site not to load it won't load of course.
Sergey Alexandrovich Kryukov 4-Feb-14 2:33am    
No, you didn't develop a Web browser... :-)
—SA

1 solution

Suppressing errors doesn't mean they go away: it just means that they aren't reported to the client. It still means that the operation -whatever it is - stops, and that can mean (as in this case) that the site fails to load.

Suppression doesn't fix errors. It's like chopping wood: if your axe is missing but you suppress the 'MissingAxe' error, you can stand there moving your arms up and down all you want but you will never get smaller logs!
 
Share this answer
 
Comments
sathish4303 4-Feb-14 7:56am    
then how internet Explorer minimize the script errors in the browser's status bar.
please explain me..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900