How to initiate/send SMS from a HTML5 webpage using devices native functions?

后端 未结 3 1887
生来不讨喜
生来不讨喜 2021-01-31 11:02

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 prep

相关标签:
3条回答
  • 2021-01-31 11:33

    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>
    
    0 讨论(0)
  • 2021-01-31 11:34

    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');
    
    0 讨论(0)
  • 2021-01-31 11:54

    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.

    0 讨论(0)
提交回复
热议问题