码迷,mamicode.com
首页 > Windows程序 > 详细

delphi webbrowser 跨域访问

时间:2015-07-17 11:34:01      阅读:230      评论:0      收藏:0      [点我收藏+]

标签:

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;

delphi webbrowser 跨域访问

标签:

原文地址:http://www.cnblogs.com/honeynm/p/4653651.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!