Mega Code Archive

 
Categories / Delphi / LAN Web TCP
 

How to check if a page in TWebbrowser is on a local drive

Title: How to check if a page in TWebbrowser is on a local drive procedure TForm1.Button1Click(Sender: TObject); begin Webbrowser1.Navigate('file:///c:/test.txt'); end; procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject; const pDisp: IDispatch; var URL: OleVariant); begin if Webbrowser1.Oleobject.Document.Location.Protocol = 'file:' then begin label1.Caption := 'The file is on a local drive!' end; end;