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

1

2 Answers 2

1

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

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

Comments

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;  
}  

1 Comment

Thanks for reply @hicurin ... i mention the WebBrowser from WPF (System.windows.controls).Your answer related to WinForms related Web Browser.

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.