1. Home
  2. /
  3. Forum

Forum

Notifications
Clear all

Click to SMS or click to text


Sudhanshu Mishra
(@manager)
Member Admin
Joined: 1 year ago
Posts: 13
Topic starter  

The following code on page load first updates the anchor href or link.

First, add an anchor tag on the webpage. And, then add the below script.

The below code will first update the anchor href value and on click (on android and iPhone devices), opens up the message box on phone.

jQuery(document).ready(function(){
	
	if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
		jQuery("#messageLink").attr("href", "sms:+10000000000&body=Hi, I have a question regarding your service.  ");
	}else{
		jQuery("#messageLink").attr("href", "sms:+10000000000?body=Hi, I have a question regarding your service.  ");
	}
	
});

Quote
Share:
Reviews & Ratings Get your stoe online with Shopify in 60 minutes Shop Now