wpf webBrowser 没有在带有 js 错误的页面上触发 loadCompleted

wpf webBrowser not firing loadCompleted on page with js error

我正在使用 wpf webBrowser 控件。 loadComplete 事件未触发。我查看了我正在导航的页面,发现它有一些 js 错误。我假设这就是原因。任何人都可以找出解决方法吗?我需要触发事件。

谢谢

这就是导致我出现问题的原因:

前一段时间,我添加了这段代码来防止安全文件消息(参见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;
            };