salvadordf / WebView4Delphi

WebView4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC for Windows.
https://www.briskbard.com/forum/
MIT License
282 stars 59 forks source link

Get html #8

Closed VandJ closed 2 years ago

VandJ commented 2 years ago

Hi. How to get html source code?

bnzbnz commented 2 years ago

WVBrowser1..ExecuteScript('encodeURI(document.documentElement.innerHTML)'); and in the ExecuteScriptCompleted event : SourceCode := TNetEncoding.URL.Decode(UTF8ToString(AResultObjectAsJson));

VandJ commented 2 years ago

Thanks, it worked.

amancini commented 2 years ago

Really a great job, thank you very much. You can consider including a GetHTMLSource-like function from the AMEdgeBrowser library https://github.com/amancini/AMEdgeBrowser/blob/main/Src/AMEdgeBrowser.pas