I'm trying to silence Javascript errors in the WPF webbrowser control. According to the "Getting to the native IWebBrowser2" comment on this page, one can access the IWebBrowser2 interface. From there I thought I could set the Silent property to true, like this:
/// <summary>
/// Handle navigation events
/// </summary>
protected virtual void OnNavigated(object sender, NavigationEventArgs e)
{
MakeComBrowserSilent();
}
private void MakeComBrowserSilent()
{
IServiceProvider serviceProvider = (IServiceProvider)_webViewer.Browser.Document;
Guid serviceGuid = SID_SWebBrowserApp;
Guid iid = typeof(SHDocVw.IWebBrowser2).GUID;
SHDocVw.IWebBrowser2 comBrowser = (SHDocVw.IWebBrowser2)serviceProvider.QueryService(ref serviceGuid, ref iid);
comBrowser.Silent = true;
//comBrowser.PutProperty("Silent", true);
}
I've tried the Silent=true, and also PutProperty. Neither works and I still get Javascript errors popping up.
Anyone know how to silence Javascript debug errors in the WPF WebBrowser control?
TIA.