19

I am wondering how can I open the send SMS application by using a web control of a HTML5 page on Android and iPhone. I want to use the device native SMS sending app, with a prepopulated value from the web.

Pentium10
  • 204,586
  • 122
  • 423
  • 502
  • RFC5724 http://tools.ietf.org/html/rfc5724 – Joe Apr 19 '11 at 19:15
  • Any information if that is in-built in todays devices? – Pentium10 Apr 19 '11 at 19:17
  • 1
    I think iPhone is limited to just a number https://developer.apple.com/library/safari/#featuredarticles/iPhoneURLScheme_Reference/Articles/sms.html – Joe Apr 19 '11 at 19:24
  • It looks like Android is limited to just a number - it will not parse the body into the created SMS message – Mampersat May 03 '12 at 20:18
  • On iPhone it only works if you format the number with international dialling code (eg. +43123333) and not with 0 in front (eg. 0123333). SMS text is not allowed - even number is then ignored. – besimple Jun 05 '14 at 11:07

3 Answers3

28

Further to other answers I can confirm that smsto:555:bodytext does not work on an iPhone running iOS5.

What does work (and I've tested it) on Android is the format:

sms:444?body=hello

Example:

<a href="sms:444?body=hello">Tap to say hello!</a>

On iPhone the ?body=hello will prevent it working at all, and you should use just sms:555 instead.

sms:555

Example

<a href="sms:444">Tap to text us!</a>
Ben Clayton
  • 80,996
  • 26
  • 120
  • 129
  • Ben, I do not understand how can you claim that body attribute works in Android, it does not atleast in stock Android Browser and a bug12142 (http://code.google.com/p/android/issues/detail?id=12142 ) exists for this which is still not resolved. What works is a URI with only the number, body attribute does not work – Raks May 14 '12 at 11:57
  • Hiya. The body tag definitely worked on the devices I tested with at the time, I should have written down which they were. It's possible that 'stock' Android doesn't support this I suppose. – Ben Clayton Apr 15 '13 at 13:43
  • Works fine both on Blackberry 10 and LGE LG-E610 (native browsers). – besimple Jun 04 '14 at 20:36
  • 2
    to make it work on iOS, use `sms:5555551212;body=hello` – Paul Sturm Jul 15 '14 at 02:20
  • can anyone tell how to do it in windows phone enviroinment? – kamesh Jun 04 '15 at 12:27
1

I have tested the below and it works:

Using HTML Anchor tag:

<a href="sms:111?body=SUBSCRIBE">Subscribe</a>

Using JavaScript:

window.open('sms:111?body=SUBSCRIBE', '_self');
Blesson Jose
  • 698
  • 9
  • 14
0

With Android 3.0 SDK Google has started exposing API in HTML5 for device access. An example is listed here. It may not be enough for what you seek to do.

I dont know enough about iphone to advise either way.

omermuhammed
  • 7,365
  • 4
  • 27
  • 40