Page 1 of 1
Click Tel : Phone problem
Posted: Fri Jun 09, 2023 1:38 pm
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
Re: Click Tel : Phone problem
Posted: Fri Jun 09, 2023 3:05 pm
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.
Re: Click Tel : Phone problem
Posted: Fri Jun 09, 2023 5:17 pm
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
Re: Click Tel : Phone problem
Posted: Fri Jun 09, 2023 5:17 pm
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
Re: Click Tel : Phone problem
Posted: Sat Jun 10, 2023 7:11 am
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.