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

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


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>


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');


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.