0

On my website i have button that triggers SMS to my phone. And it works fine for mobile users.

<a href="sms:+**********?body=Describe your question" class="default-btn-sized default-btn mobile-option">Start Chat</a>

But what can i do with desktop users? Is there a way to send this contact to their phone? or what is common approach about that?

tttaaabbb
  • 407
  • 7
  • 19
  • "Is there a way to send this contact to their phone?" Not really. If you click on it there are a few applications on a computer that can handle them links (Skype I think) but _normal_ practice would be to just include a phone number in plain text. – George Jul 15 '20 at 10:53
  • 1
    You want a desktop based browser to open a text-message on their phone?! – freefaller Jul 15 '20 at 10:54
  • @freefaller kinda, i know i can send map coordinates from desktop to my phone, but i guess i has to do with Google map service and shared email. Just wonder if similar possible in my case – tttaaabbb Jul 15 '20 at 11:02

2 Answers2

0

You could use something like an SMPP protocal to send sms via a server side script like PHP. Along with some tricks...

Example PHP SMPP lib Code: https://github.com/onlinecity/php-smpp

Things to do:

var pathname = $(location).attr("pathname");
if (
  /android|webos|iphone|ipad|ipod|blackberry|nokia|opera mini|opera mobi|skyfire|maemo|windows phone|palm|iemobile|symbian|symbianos|fennec/i.test(
    navigator.userAgent.toLowerCase()
  )
) { /* mobile code */ } else { /* desktop code */ }
Dharman
  • 30,962
  • 25
  • 85
  • 135
0

Desktop does not support sending SMS messages. Unless you have an application to send messages on your device, if you have an application, you will need to open the application, you can check this link how to start up a desktop application in client side But there are other ways such as sending an email and you can do this

<a href="mailto:someone@example.com">start email</a>

and u can start chat in whatsapp like this :

<a href="https://api.whatsapp.com/send?phone=*****">start whatsapp</a>