logo
Home XtGem- Templates- XtScript- bottom
XtGemmanual

XtGem tags and tools

sms iOS fix

Sms link script for standard mobiles and iphone

Notes

The XtGem "click to sms" block just adds a preset phone number and no text in the body of the sms message
The problem with sms: urls is there are 3 different methods to add body text Then just because Apple want to be different Some old mobiles do want the body data url encoded and some do not
Also some will not work without a number being declared so I have placed a 0 in the number field

Example

<script>
var ua = navigator.userAgent.toLowerCase();
var url = "sms:0";
var is_os8 = (ua.indexOf("os 8") > -1) ? "&" : ";";
url += (ua.indexOf("iphone") > -1 || ua.indexOf("ipad") > -1) ? is_os8 : "?";
url += "body=" + encodeURIComponent("Hey check this out <xt:url />");
document.write('<div><a class="xt_button" href="'+url+'">Text this page to your friends</a></div>');
</script>

Copy as text

Output reload

Related

click to sms

XtGem manual · all sections

Powered by XtGem
About us Contact Forum top