Webbrowser PHP

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Kullanıcı avatarı
barutali
Üye
Mesajlar: 297
Kayıt: 02 Tem 2007 02:30

Re: Webbrowser PHP

Mesaj gönderen barutali »

o kodu bende bi ara bulmuştum ..

Kod: Tümünü seç

implementation
 uses MSHTML;
{$R *.dfm}

Function Tform1.JSLinkAc(Link: string): string;
var
  Doc: IHTMLDocument2;
  HTMLWindow: IHTMLWindow2;
  JSFn: string;
begin
  Doc := WebBrowser1.Document as IHTMLDocument2;
  if not Assigned(Doc) then
    Exit;
  HTMLWindow := Doc.parentWindow;
  if not Assigned(HTMLWindow) then
    Exit;
  try
    JSFn := Format('openURL("%s")', [link]); // openURL js de kullanılan function ın adı oluyor.. 
    HTMLWindow.execScript(JSFn, 'JavaScript');
  except
   ShowMessage('Sayfa Yüklenemedi');
  end;
end;
kullanımı

Kod: Tümünü seç

JSLinkAc("http://www.google.com.tr"); 
gibi yani tıklayınca açtığı url yi yazıyoruz..

belki işine yarar ...
Cevapla