Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

Get Source from Frame page....

Post Reply
crystalxp
Posts: 39
Joined: Tue Jul 04, 2017 8:23 am

Get Source from Frame page....

Post 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 !
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Get Source from Frame page....

Post 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.
crystalxp
Posts: 39
Joined: Tue Jul 04, 2017 8:23 am

Re: Get Source from Frame page....

Post by crystalxp »

Thanks for your quickly replay...
both solution i will try them..
:D
Post Reply