5

I have a sms link on a webpage:

<a href="sms:+15553332222?body=message">SMS Link</a>

And that works great on my Nexus (running stock gingerbread) but two other phones (both HTC's on gingerbread with Sense UI) won't open the link saying "Invalid recipient". If I remove the body parameter on the link it works fine, but I need the body parameter. I've tried diffrent formatting of the number including +15553332222, 15553332222, 5553332222, +1-555-333-2222, and 555-333-2222. I've also tried using sms:, smsto:, and mms: with the same result.

I'm I doing it wrong? Is this a known problem for HTC's phones? If it is, is there a work around?

Philipp Reichart
  • 20,771
  • 6
  • 58
  • 65
Scott
  • 3,290
  • 4
  • 29
  • 48
  • some code, some logcat error would be appreciated. – Anurag Ramdasan Apr 11 '12 at 16:54
  • can you paste your sms related code – Shankar Agarwal Apr 11 '12 at 16:54
  • 1
    What code are you looking for its just the html link. – Scott Apr 11 '12 at 17:14
  • Does the problem actually occur with the exact link in your question, i.e. a single-word body without any spaces/other special characters? If it only happens for longer bodies (e.g. sentences), you might not be URL-encoding the value of the `body` parameter correctly. – Philipp Reichart Apr 11 '12 at 20:17
  • I checked it using my HTC Desire HD, using Android 2.3.5 and it indeed failed there as you described (using ASCII only, no spaces). On my HTC One X using Android 4.0.3 it works correctly, so HTC just might have fixed it somewhere in between in their messaging app. (The behaviour was also mentioned here: http://stackoverflow.com/a/5692400/151682 but without workaround) – Patrick Apr 11 '12 at 21:05
  • Yes link as witten failed with no spaces or special characters. It does work on my Nexus running 2.3.7 so my guess is its a problem with older Sense versions or older versions of Android. Does anyone know of a work around? – Scott Apr 11 '12 at 22:31

2 Answers2

2

Try

<a href="sms://+35555&body=Helloworld">

Use the ://

Lionel Yeo
  • 383
  • 4
  • 13
0

I've got the same problem, and got just a little bit closer.

Using

<a href="sms:+351234567;body=hello%20world">One number with body text sep ;</a>

sets the msisdn correctly but fails with error "Invalid recipient: <body=hello world>"

Android 4.0.3

HTC Sence 3.6

Christian Scholz
  • 309
  • 1
  • 3
  • 10
  • I'm not sure thats to much closer, it obviously getting some data but just not the correct data. – Scott Jun 14 '13 at 13:19