...check if a page in TWebbrowser is on a local drive?

Author: Dev4u.ch
Homepage: http://www.dev4u.ch

Category: Internet / LAN

// You need: A TWebbrowser, TButton, TLabel
// Du Brauchst: Einen TWebbrowser, TButton, TLabel

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!'
    // label1.Caption := 'Das File befindet sich auf einer lokalen Harddisk!'
  
end;
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base