FNC Web Browser

Can't get it to work in Lazarus. However, it does work in Delphi 10.3. Is there a method to retrieve the current html page being shown and assign to a string or some structure?

It's something like this:


TMSFNCWebBrowser1.ExecuteJavascript('function GetHTML(){return document.documentElement.innerHTML;} GetHTML();',
   procedure(const AValue: string)
   begin
     memo1.Lines.Text:= UnescapeString(AValue);
     memo1.Lines.SaveToFile('testfile.html');
   end
   );
procedure TTreeForm.Button2Click(Sender: TObject);
begin
  TMSFNCWebBrowser1.LoadHTML('<!DOCTYPE html>'+
  '<html>'+
  '<head>'+
'<script src="https://cdn.ckeditor.com/ckeditor5/19.1.1/classic/ckeditor.js"></script>'+
  '</head>'+
  '<body>'+
'<div id="editor">'+
    '<p>Here goes the initial content of the editor.</p>'+
'</div>'+
'<script>'+
'let editor;'+
'ClassicEditor'+
    '.create( document.querySelector( ''#editor'' ) )'+
    '.then( newEditor => {'+
        'editor = newEditor;'+
    '} )'+
    '.catch( error => {'+
        'console.error( error );'+
    '} );'+
'</script>'+
  '</body>'+
'</html>');
 end;

function UnescapeString(aStr: string): string;
 var
  LJSONValue: TJSONValue;
begin
  LJSONValue:= TJSONObject.ParseJSONValue(TEncoding.UTF8.GetBytes(aStr),0);
  result:= LJSONValue.ToString;
end;

procedure TTreeForm.Button3Click(Sender: TObject);
 var
  Buffer: PChar;
  Size: Byte;
begin
   TMSFNCWebBrowser1.ExecuteJavascript('function GetHTML(){return editor.getData()} GetHTML();',
   procedure(const AValue: string)
   begin
     memo1.Lines.Text:= UnescapeString(AValue);
   end
   );
 end;

Yes, the code you are using works. But anonymous methods are not supported under Lazarus? You can work with a method defined at form level. document.body.innerHTML should return you the Page HTML

Didn't get that far with Lazarus. Was just trying to get the web browser to recognize that Edge canary was installed. Only difference with that Laz app is a 64 bit app and Delphi is a 32 bit app. Haven't tried Laz 32 yet.

Dlls should be copied in both System32 & SysWow64