How can i get HTML source using CEF4 ?

Post Reply
User avatar
salvadordf
Posts: 3067
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How can i get HTML source using CEF4 ?

Post by salvadordf »

It's all in the MiniBrowser demo.

To get the HTML source you just have to call TChromium.RetrieveHTML and then wait for the TChromium.OnTextResultAvailable event. You'll have the HTML code in the aText parameter of that event.
alexhsieh
Posts: 1
Joined: Thu Sep 09, 2021 10:12 am

Re: How can i get HTML source using CEF4 ?

Post by alexhsieh »

Hi , I am a new user for using this. Can you post a sample code for me , very thanks!
User avatar
salvadordf
Posts: 3067
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How can i get HTML source using CEF4 ?

Post by salvadordf »

Hi,

The code is in the MiniBrowser demo.

Here is the call to TChromium.RetrieveHTML :
https://github.com/salvadordf/CEF4Delphi/blob/master/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas#L1426

And here you get the HTML source in the "aText" parameter of the TChromium.OnTextResultAvailable event :
https://github.com/salvadordf/CEF4Delphi/blob/master/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas#L1002

Read this document for more information about CEF4Delphi :
https://www.briskbard.com/index.php?lang=en&pageid=cef
alexhsieh
Posts: 1
Joined: Thu Sep 09, 2021 10:12 am

Re: How can i get HTML source using CEF4 ?

Post by alexhsieh »

Very Thanks! Got it. Solved.
Post Reply