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 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 cross-domain access