D
D
docbrain2016-04-06 19:42:20
Delphi
docbrain, 2016-04-06 19:42:20

How to get URL from Chrome-based browser in Delphi?

Good time of the day.
I have some code to find out which URL is currently open in the browser. There he is:

procedure TForm1.Button1Click(Sender: TObject);
var
 Temp:WideString;
begin
   DdeClientConv1.SetLink('brausername','WWW_GetWindowInfo');
   Temp:=DdeClientConv1.RequestData('sUrl');
   ShowMessage(Temp);
end;

And another option:
procedure TForm1.Button1Click(Sender: TObject);
var
 Temp,url:WideString;
begin
   DdeClientConv1.SetLink('opera','WWW_GetWindowInfo');
   Temp:=DdeClientConv1.RequestData('sUrl');
   delete(Temp,1,pos('"',temp));
   url:=copy(temp,1,pos('"',temp)-1);
   ShowMessage(Url);
end;

But there is one problem: this code does not work in Google Chrome, as well as browsers based on its engine. And since now almost all browsers use the Chrome engine (FireFox and IE do not count), it turns out that this code does not work at all.
Anyone knows how can get the url from chrome? Thanks in advance.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question