Firemonkey Delphi TWebBrowser 获取文本/HTML

3

我如何在Firemonkey平台(Android/iOS)获取网页的文本/HTML内容?TWebBrowser没有相关功能...


可能是What's the simplest way to call Http GET url using Delphi?的重复问题。请使用Indy示例(TIdHTTP),而不是WinINet。 - Marcus Adams
不一样。当用户更改HTML输入值后,想要获取TWebBrowser的getText! - Amin
2个回答

3

0

这是我用来获取HTML文本的方法

          function GetURL(const AURL: string): string;
          var
            HttpClient: THttpClient;
            HttpResponse: IHttpResponse;
            begin
              HttpClient := THTTPClient.Create;
              try
                HttpResponse := HttpClient.Get(AURL);
                // memo1.Text:=HttpResponse.ContentAsString();
                Result := HttpResponse.ContentAsString();
                finally
                HttpClient.Free;
              end;
            end;

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接