delphi Webbrowser 获取网页源代码

来源:互联网 发布:暴走大事件 淘宝诈骗 编辑:程序博客网 时间:2024/04/30 02:59

uses MSHtml


funct Get_html(WEB:TWebbrowser):string;

var
  IHTML:IHTMLElement;
begin
   if Assigned(WEB.Document) then
   begin
    IHTML := (WEB.Document AS IHTMLDocument2).body;
      while IHTML.parentElement <> nil do
       begin
           IHTML:= IHTML.parentElement;
            end;
           Result := IHTML.outerHTML;
    end;


end;