Opening SMS app from feature phone's mobile browser?
Asked Answered
H

3

9

Via HTML, is it possible to access/open the SMS app from a mobile browser?

It's okay if the SMS is routed through the user's own mobile carrier (like normally), and is billed to the said user as well. I don't want to create my own SMS gateway to provide a platform for sending such messages. I'm only interested in calling the SMS functionality from the mobile browser.

I've seen examples of: <a href="sms://+14035550185">Send an SMS</a> But I'm unsure how extensively they work. I need a robust solution that works across an expansive range of mobile browsers (esp. old-school feature phones). I don't want to have to use HTML5 or Javascript. Most old-school feature phone browsers I'm targeting aren't Javascript-enabled - so it's a bottleneck.

Hemistich answered 10/7, 2015 at 13:43 Comment(0)
H
10

I added the following in my template and got the desired results: <a href="sms:+1234?body={{ link.description }}" style="color:blue;background-color:#FFA500">SMS</a>

Don't mind the Django tag: {{ link.description }}

The generic usage for anyone is <a href="sms:1234567?body=hello world">Send SMS</a>

Hemistich answered 13/7, 2015 at 9:13 Comment(1)
it is not working onLoad user have to specifically click on the link.Notion
H
26

If you want to add a pre-fabricated message to the sms, Android and iOS devices require slightly different syntax. Note the '&' vs '?' below.

iOS:

<a href="sms:1234&body=hi">Send an SMS</a>

Android:

<a href="sms:1234?body=hi">Send an SMS</a>
Hengelo answered 16/11, 2016 at 20:41 Comment(4)
Thanks for this. Any information on which Android OS versions the code is compatible with?Hemistich
This worked for me. In addition to this, do an encodeURIComponent() on your body text.Battledore
What If I don't want to add any default number?Hamby
event when I use encodeURIComponent() on Android, the & char is cutting my url.Damalus
H
10

I added the following in my template and got the desired results: <a href="sms:+1234?body={{ link.description }}" style="color:blue;background-color:#FFA500">SMS</a>

Don't mind the Django tag: {{ link.description }}

The generic usage for anyone is <a href="sms:1234567?body=hello world">Send SMS</a>

Hemistich answered 13/7, 2015 at 9:13 Comment(1)
it is not working onLoad user have to specifically click on the link.Notion
F
0

There is no way for a feature phone's browser to send arbitrary SMS messages in response to some HTML page (that would be a major security vulnerability if it were possible...).

If you really want broad feature phone support you'll need to spin up a solution using an SMS gateway such as Twilio. The phone's browser will GET / POST to your web application, then your web application will POST to Twilio to send the appropriate message.

Fuddyduddy answered 10/7, 2015 at 14:42 Comment(1)
I'm not really after 'sending' an SMS from the browser. Is it possible to access and open the SMS app from the mobile browser? I also fine-tuned the problem statement to reflect this.Hemistich

© 2022 - 2025 — McMap. All rights reserved.