Page 1 of 1

Get Source from Frame page....

Posted: Tue Jul 11, 2017 5:52 pm
by crystalxp
How to get source from a framed page ...the RetrieveHTML function could just get the mainframe page source .....how to get subframe's page source
I try to use this code

var
Visitor: ICefStringVisitor;
begin
Visitor := TCustomCefStringVisitor.Create(self);
if TargetFrame <> nil then
begin
mmo2.Text := TargetFrame.Name; // <!--framePath //<!--frame0-->-->
TargetFrame.GetSource(Visitor);
end;
end;
but it isn't work at all.

thank you !

Re: Get Source from Frame page....

Posted: Tue Jul 11, 2017 9:02 pm
by salvadordf
Hi,

There are two possible solutions :
  • Modify TChromium.Internal_GetHTML to search for a frame and use it with the visitor instead of the main frame.
  • Use javascript to get the the innerHTML from the document inside a frame and then send the results to Delphi.
If you try the first solution you must recompile CEF4Delphi and call RetreiveHTML like before.

The second solution doesn't require to recompile CEF4Delphi and you can reuse most of the code about the javascript extension from the MiniBrowser demo.

Make sure to wait for all frames to be loaded before trying to get the HTML.

Re: Get Source from Frame page....

Posted: Wed Jul 12, 2017 1:26 am
by crystalxp
Thanks for your quickly replay...
both solution i will try them..
:D