2

I want to be able to launch the iPhone and/or Android SMS app with "body" or "message" field already having the correct text.

I came across this question however the top answer was only partially working for me and it didn't ask everything I was looking for.

From what I can tell, either of the following will launch the sms app on my iPhone and gives the correct number to send it to.

<a href="sms:1-234-567-8901">Send SMS</a>
<a href="sms:12345678901">Send SMS</a>

As soon as I ad something like ?body=hello or ?message=hello it fails to bring over the phone number and body text.

These fail:

<a href="sms:1-234-567-8901?body=hello">Send SMS</a>
<a href="sms:12345678901?message=hello">Send SMS</a>

Any help or insight would be greatly appreciated!

Community
  • 1
  • 1
bigmike7801
  • 3,908
  • 9
  • 49
  • 77

6 Answers6

5

This will work on IOS to populate a message body:

without a number,

?body= will not work, must be &body=

<a href="sms://&body=your message here"> send a message </a>

or, with a number

<a href="sms://5555555555&body=your message here"> send a message </a>
JMcG
  • 51
  • 1
  • 1
3

I'm afraid the answer won't be what you're hoping for - currently neither Android nor iOS will let you launch an SMS from the browser with a pre-populated message body. You can only trigger a blank SMS from the browser to a specific number. This holds for all versions of iOS, and whilst I haven't tried it out on Android 4.0, I don't see anything pointing to a change. Sorry that it isn't better news!

Here's Apple's complete list of URL schemes that they support: Apple's URL Scheme Reference,

lxt
  • 31,146
  • 5
  • 78
  • 83
  • Do you happen to know of any javascript library that night be able to replicate this? Also, do you have any documentation supporting your answer? It's not that I don't trust you, it's just that I'd like to read more on it if possible. -Thanks – bigmike7801 Feb 09 '12 at 19:52
  • Sure, no problem - I've added a link to Apple's URL reference. A JavaScript library isn't really going to help you: native apps can on both platforms respond to URLs, like 'tel:' or 'sms:'. But if an app doesn't support it, it's not supported period. Android is slightly different, because there is variance between the SMS apps installed on devices...but 'out of the box' it's the same situation as iOS. – lxt Feb 09 '12 at 19:56
  • 4
    This answer is completely incorrect now (2015...maybe back in the day this was the case). iOS is sms:1280&body=100, Android is sms:1280?body=100 – Jerod Venema Oct 09 '15 at 21:26
1

This is working on Android:

e.g.,

<a href="sms://?body=Visit%20the%20best%20site%20at%20http://example.com">

or

<a href="smsto://?body=Visit%20the%20best%20site%20at%20http://example.com">

but not on iOS.

TRiG
  • 10,148
  • 7
  • 57
  • 107
Max
  • 343
  • 3
  • 9
1

The below worked fine on Android and blackberry devices

<a href="sms:12345678901">Send SMS</a>

<a href="sms:1-234-567-8901?body=hello">Send SMS</a>

<a href="sms:12345678901?message=hello">Send SMS</a>

On the other hand Iphone does not allow adding the pre-generated text message. it will only open with the recipient field filled.

Salem
  • 311
  • 2
  • 12
  • False. iOS does allow you to prepopulate SMS. However it will never send it for you automatically. – sebrock Oct 11 '13 at 14:51
  • @sebrock. What you're saying contradicts the accepted answer. If things have changed since that was posted (Feb. 2012), or if you have more information, please post your own answer. – TRiG Nov 12 '13 at 23:57
  • iOS is now supported; sms:1280&body=100 – Jerod Venema Oct 09 '15 at 21:25
0

Try adding a semi-colon after the question mark in line of code.

This has been working for me until the recent upgrade to ios7. It should still work on the iPad. I'm not sure what the issue is with the current ios update, but the sms suddenly stopped working for my application. I did create separate buttons for pre-populated body content. One for Droid and one for iPhone. That may be a another option to try.

Jim
  • 1
0

It is possible to have iphone apps send messages to the compose sms screen and insert the body content, i have personally seen it working and tried it from a developer who wrote the functionality in Object C

I there are also a number of phone gap / cordova plugins that can also achieve it but i am having trouble getting the write version of cordoval to match with the plugins that have been written

so in short YES in iphone app sms creation is possible

user2134512
  • 11
  • 2
  • 8