SMS URL on Android

前端 未结 8 1841
我寻月下人不归
我寻月下人不归 2020-11-30 07:22

I was wanting to know if Android had a similar feature to the iPhone in that you can use an HTML A tag to send an SMS by setting the HREF attribute to the phone

相关标签:
8条回答
  • 2020-11-30 08:00

    I found the following which may help you:

    http://tools.ietf.org/html/rfc5724

    You can check sub-section 2.5 or 2.6 of this RFC to give you some additional pointers on formulating a proper SMS URL.

    For example: ... <a href="sms:+19725551212?body=hello%20there">SMS Me</a>
    ...

    Notice the 'escaped' character for the 'space' in the example above.

    Hopefully the Android browser will permit you to generate XHTML forms based on this syntax. I believe they will (if I have some time over the next day, I shall give it a try on my Galaxy S).

    0 讨论(0)
  • 2020-11-30 08:03

    If multiple recipients needed, this works:

    Android:

    sms:+15558675309,+15558675301?body=Text%20Here%20end!
    

    iOS, macOS:

    sms://open?addresses=+15558675309,+15558675301/&body=Text%20Here%20end!
    
    0 讨论(0)
  • 2020-11-30 08:08

    I have noticed if you use a qrc code with text for mms:<phone_number>?body=<your message here.> this seem to work and avoid the error: invalid recipient(s)

    here is a test qrc http://qrcode.kaywa.com/img.php?s=8&d=mms%3A555-555-5555%3Fbody%3DYour%20Message

    0 讨论(0)
  • 2020-11-30 08:12

    You could use a CSS trick to display one or the other: CSS media query to target only iOS devices

    @supports (-webkit-touch-callout:none) {
      /* CSS specific to iOS devices */ 
      .android { display:none }
      }
    
    @supports not (-webkit-touch-callout:none) {
      /* CSS for other than iOS devices */
      .ios { display:none }
      }
    
    <a class="ios" href="sms://+12345">SMS me</a>
    <a class="android" href="sms:+12345">SMS me</a>
    
    0 讨论(0)
  • 2020-11-30 08:15

    That should work:

    <a href="sms:+437722735932">contact</a>
    
    0 讨论(0)
  • 2020-11-30 08:15

    If you need a URL working for both Android and iOS you can do this trick:

    sms:+123456789?&body=hello%20there
    
    0 讨论(0)
提交回复
热议问题