Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

Click Tel : Phone problem

Post Reply
tetradox_44
Posts: 6
Joined: Mon May 21, 2018 6:46 pm

Click Tel : Phone problem

Post by tetradox_44 »

I'm making a search on Google.com, and a phone number appears. When I click on it, it stays on a white screen. Please help me with what I need to do to open the phone number in an application like Skype or a different app.

https://prnt.sc/c27kULY8QV0o

https://prnt.sc/R2QNNlABtm-o
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Click Tel : Phone problem

Post by salvadordf »

Hi,

Try using the TChromium.OnProtocolExecution event. If that link is using a different protocol then you can intercept it in this event and execute a third party application to handle the new URL.
tetradox_44
Posts: 6
Joined: Mon May 21, 2018 6:46 pm

Re: Click Tel : Phone problem

Post by tetradox_44 »

salvadordf wrote: Fri Jun 09, 2023 3:05 pm Hi,

Try using the TChromium.OnProtocolExecution event. If that link is using a different protocol then you can intercept it in this event and execute a third party application to handle the new URL.
thank you bro.

Code: Select all

procedure TForm1.Chromium1ProtocolExecution(Sender: TObject;
  const browser: ICefBrowser; const frame: ICefFrame;
  const request: ICefRequest; var allowOsExecution: Boolean);
var
  PhoneNumber: string;
  SkypeCommand: string;
  Response: ICefProcessMessage;
begin
  // Telefon numarası linki kontrolü
  if Pos('tel:', request.Url) = 1 then
  begin
    // Telefon numarasını al
    PhoneNumber := Copy(request.Url, 5, Length(request.Url));

    // Skype komutunu oluştur
    SkypeCommand := 'skype:' + PhoneNumber;

    // Skype ile telefon numarasını aç
    ShellExecute(0, 'open', PChar(SkypeCommand), nil, nil, SW_SHOWNORMAL);

    // Telefon numarası açıldığında Google'a bir yanıt döndür
    Response := TCefProcessMessage.New('custom_protocol_execution');
    Response.ArgumentList.SetString(0, 'skype');
    Chromium1.SendProcessMessage(PID_BROWSER, Response);

    // Telefon numarası açıldığından emin olmak için işlemi durdur
    allowOsExecution := False;
  end;
end;
there is another problem TCefProcessMessage.New
https://prnt.sc/D35O_eRlqt1r
tetradox_44
Posts: 6
Joined: Mon May 21, 2018 6:46 pm

Re: Click Tel : Phone problem

Post by tetradox_44 »

salvadordf wrote: Fri Jun 09, 2023 3:05 pm Hi,

Try using the TChromium.OnProtocolExecution event. If that link is using a different protocol then you can intercept it in this event and execute a third party application to handle the new URL.
thank you bro.

Code: Select all

procedure TForm1.Chromium1ProtocolExecution(Sender: TObject;
  const browser: ICefBrowser; const frame: ICefFrame;
  const request: ICefRequest; var allowOsExecution: Boolean);
var
  PhoneNumber: string;
  SkypeCommand: string;
  Response: ICefProcessMessage;
begin
  // Telefon numarası linki kontrolü
  if Pos('tel:', request.Url) = 1 then
  begin
    // Telefon numarasını al
    PhoneNumber := Copy(request.Url, 5, Length(request.Url));

    // Skype komutunu oluştur
    SkypeCommand := 'skype:' + PhoneNumber;

    // Skype ile telefon numarasını aç
    ShellExecute(0, 'open', PChar(SkypeCommand), nil, nil, SW_SHOWNORMAL);

    // Telefon numarası açıldığında Google'a bir yanıt döndür
    Response := TCefProcessMessage.New('custom_protocol_execution');
    Response.ArgumentList.SetString(0, 'skype');
    Chromium1.SendProcessMessage(PID_BROWSER, Response);

    // Telefon numarası açıldığından emin olmak için işlemi durdur
    allowOsExecution := False;
  end;
end;
there is another problem TCefProcessMessage.New
https://prnt.sc/D35O_eRlqt1r
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Click Tel : Phone problem

Post by salvadordf »

Hi,

Process messages are used to send information between the Chromium processes.

TChromium.OnProtocolExecution is executed in the main browser process. In fact it's executed in a CEF thread but you can send a normal Windows message to the main form to execute something else in the main application thread.
Post Reply