0

I am developing a windows application with a WPF WebBrowser control that navigates to a JavaScript related site. My problem is that i am getting JavaScript error.

How can i disable the JavaScript error? I don't want them to pop up.

I find answer for WinForms WebBrowser at Disable JavaScript error in WebBrowser control. But "ScriptErrorsSuppressed" property doesn't exist in WPF WebBrowser. How to do this in WPF WebBrowser.

Thanks Satish

Community
  • 1
  • 1
Satish
  • 391
  • 4
  • 22

2 Answers2

1

I didn't found easy way. So i just change WPF WebBrowser to WinForms WebBrowser and webBrowser.ScriptErrorsSuppressed = true; Thanks Satish

Satish
  • 391
  • 4
  • 22
0

Try this

//add the handler.  
...  
myWebBrowser.Document.Window.Error += new HtmlElementErrorEventHandler(this.JavascriptErrorHandler);  
...  

private void JavascriptErrorHandler(object sender, HtmlElementErrorEventArgs e)  
{  
    // Handle the error. For now, just ignore.  
    e.Handled = true;  
}  
Ringo
  • 3,795
  • 3
  • 22
  • 37
  • Thanks for reply @hicurin ... i mention the WebBrowser from WPF (System.windows.controls).Your answer related to WinForms related Web Browser. – Satish Dec 13 '13 at 10:46