Link to SMS from your web site/app with pre-filled msg

Link to SMS from your web site/app with pre-filled msg

If you want to add a feature where in you have to open the native SMS client with some msg content along with the recipient's mobile number. You can do something similar to 'mailto' for email.

For Android

<a href="sms:900000000?body=Hi Call me"> Call Me </a> 

For iOS > 8

<a href="sms:900000000&body=Hi Call me"> Call Me </a> 

You can also combine both to support Android and iOS

<a href="sms:900000000?&body=Hi Call me"> Call Me </a>

You can try it here

[Call Me](sms:900000000?&body=Hi Call me)

iOS < 7

<a href="sms:900000000;&body=Hi Call me"> Call Me </a>

From what I read looks like iOS 7 only works with phone number value, for others it's not mandatory.

This can be done dynamically using javascript.


<a href="javascript:;" id="callMeSMS"> Call Me </a>


var callElement = document.getElementById("callMeSMS");

callElement.onclick = function() {
    window.location.href = "sms:900000000?&body=Hi Call me"

These techniques work on Chrome for iOS as well.


Vetrichelvan Jeyapalpandy

12 years of experience in web development. Javascript enthusiast. Performance is an important trait of any website, so trying to improve that wherever possible.

View Comments
Next Post

ES6 - Spread Operator

Previous Post

ReactJS 101 - Basics