Sending an SMS from an HTML anchor ✉️
What's up guys? So only the other day I found that you can use an HTML anchor to create a link for a text message, basically the same way you can do for an email.
<a
href="sms://+351914765874?&body=Follow webDevTips for awesome Web Dev related tips"
>Send Text Message</a
>
In order to do this, we need to create our anchor and on the 'href' we will type 'sms://"phone number"&body="text message content"'. It's that simple!
This will open any text message application that the user has on his device, with a text ready to be sent for the specified phone number and with the content that we passed in.
a {
background-color: #8125e2;
color: #fff;
font-weight: 700;
font-size: 1.3rem;
padding: 1.5rem;
border-radius: 8px;
text-decoration: none;
}
How about you? Have you ever used this? 🤓