我正在使用wpf webBrowser控件。 loadComplete事件未触发。我查看了我正在导航的页面,我发现它有一些js错误。我假设这就是原因。任何人都可以找到解决方法吗?我需要举办活动。
由于
答案 0 :(得分:0)
这就是造成我问题的原因:
前段时间,我添加了此代码以防止安全文件消息(请参阅IE10 - how to prevent "Your current security settings do not allow this file to be downloaded" popup from appearing?) 这就是阻止事件发生的原因
this.WB.Loaded += (s, e) =>
{
// get the underlying WebBrowser ActiveX object;
// this code depends on SHDocVw.dll COM interop assembly,
// generate SHDocVw.dll: "tlbimp.exe ieframe.dll",
// and add as a reference to the project
var activeX = this.WB.GetType().InvokeMember("ActiveXInstance",
BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.NonPublic,
null, this.WB, new object[] { }) as SHDocVw.WebBrowser;
// now we can handle previously inaccessible WB events
activeX.FileDownload += activeX_FileDownload;
};