Delphi:WebBrowser 的 OnDownloadComplete 一次发生多次

标签 delphi events browser

例如在此代码中:

procedure TForm1.WebBrowser1DownloadComplete(Sender: TObject);
begin
        ShowMessage('Download Completed');
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
        WebBrowser1.Navigate('http://www.google.com/');
end;

“WebBrowser1DownloadComplete”消息在 1 Navigate 上出现多次。
这很烦人,并且使该事件几乎毫无用处。

为什么会发生这种情况?如何避免这种情况?
谢谢

最佳答案

也许 OnNavigationComplete2 事件处理程序更适合您的应用程序。

Occurs immediately after the Web browser successfully navigates to a new location.

Write an OnNavigateComplete2 event handler to take specific action when the Web browser successfully navigates to a new resource. The event can occur before the document is fully downloaded, but when it occurs at least part of the document must be received and a viewer for the document created.

关于Delphi:WebBrowser 的 OnDownloadComplete 一次发生多次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11594160/

相关文章:

delphi - 如何使用JCL压缩单元解析 "Sevenzip: Error result (00000001) Incorrect function"

delphi - 通过编辑组件在 FileListbox 中搜索

xml - Delphi 中是否有将 XML 日期和时间转换为 TDateTime 的函数

android - 适用于手机和平板电脑的应用程序

javascript - 动态创建的元素上的事件绑定(bind)?

iphone - PhoneGap 事件未在 iPhone 上触发

testing - 我的网站应该在哪些浏览器上完美运行

html - 移动:滚动后 ul 内容消失

jquery - 使用 jQuery 将函数惰性绑定(bind)到多个事件

html - 网站应该在调整窗口大小时扩展吗?