Get HTML Source from Chromium Embedded

12,196

in dcef 3

procedure StringVisitor(const str: ustring);
begin
  //str is the SourceHtml
showmessage(str);
end;

function GetSourceHTML: string;
var
CefStringVisitor:ICefStringVisitor;
begin
  CefStringVisitor := TCefFastStringVisitor.Create(StringVisitor);
  Chromium1.Browser.MainFrame.GetSource(CefStringVisitor);
end;
Share:
12,196
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years

    How to do this with Delphi Chromium Embedded Component i know how to do this with TWebBrowser. But since no docs are present for this I am sure someone else had same problem.

    Thanks

  • Stéphane B.
    Stéphane B. about 9 years
    Warning : StringVisitor procedure is called asynchronously
  • delphirules
    delphirules over 8 years
    @STBLand In this case it seems the page is reloaded. How to get the source without reloading the page ?