delphi webbrowser 跨域访问


本文整理自网络,侵删。

 
procedure IterateFrames(const AWB: IWebBrowser2);
var
Doc: IHTMLDocument2;
Container: IOleContainer;
Enumerator: ActiveX.IEnumUnknown;
Unknown: IUnknown;
Browser: IWebBrowser2;
Fetched: Longint;
NewDoc: IHTMLDocument2;
begin
if (Assigned(AWB.Document)) and (Supports(AWB.Document, IHTMLDocument2, Doc)) then
begin
// Recursive searching.
// ACHTUNG! We cannot use the document's frames collection here, because
// it does not work in every case (i.e. Documents from a foreign domain).
// From: support.microsoft.com/support/kb/articles/Q196/3/40.ASP
if (Supports(Doc, IOleContainer, Container)) and (Container.EnumObjects(OLECONTF_EMBEDDINGS, Enumerator) = S_OK) then
begin
while Enumerator.Next(1, Unknown, @Fetched) = S_OK do
if (Supports(Unknown, IWebBrowser2, Browser)) and (Supports(Browser.Document, IHTMLDocument2, NewDoc)) then
begin
//DoSomethingWithNewDoc;
IterateFrames(AWB);
end;
end;
end;
end;

来源:https://www.cnblogs.com/honeynm/p/4653651.html

相关阅读 >>

Delphi 对image字段存取图片、文件

Delphi webbrowser载入自定义html内容并显示

Delphi xe5调用外部扫描程序――谷歌 zxing

Delphi 32位程序 out of memory 内存不足时解决办法之一

Delphi固定窗口大小

Delphi获取android上的imei

Delphi中ocx的动态注册方法

java2op.exe,Delphi安卓原生桥接文件生成器

Delphi清除右下角的托盘上无用的托盘图标(刷新托盘)

Delphi winexec 执行cmd

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...