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将字符串转换成utf8编码的函数

Delphi中使用directx截屏函数

Delphi 根据进程名称获取进程号

Delphi 匹配中文的正则表达式

Delphi源码webbrowser多次执行documentcomplete

Delphi 隐藏,显示其他程序的托盘图标

Delphi xe5读取android imei id

Delphi 将字符串转换成 utf8 编码的函数

Delphi 生成指定范围和个数的不重复的随机整数

Delphi 保证当前程序显示在最前

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



打赏

取消

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

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

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

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

评论

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