procedure TForm1.Button1Click(Sender: TObject);
var
url:string;
begin
url:=edit1.Text ;
webbrowser1.Navigate(url); //打开网页
end;
procedure TForm1.WebBrowser1DownloadBegin(Sender: TObject);
begin
StatusBar1.Panels[0].Text :='正在打开网页/读取链接...';
end;
procedure TForm1.WebBrowser1DownloadComplete(Sender: TObject); //待网页打开完成再读取链接
var
i,n:integer;
begin
for i:=0 to WebBrowser1.OleObject.document.links.length-1 do
listBox1.Items.Add(WebBrowser1.OleObject.document.links.item(i).href); //读取链接
n:=WebBrowser1.OleObject.document.links.length; //链接数
StatusBar1.Panels[0].Text :='网页打开完毕!'+'['+inttostr+'个链接]';
end;