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;
Kod: Tümünü seç
JSLinkAc("http://www.google.com.tr");
belki işine yarar ...