* Graham The xtgem "click to sms" block just adds a preset phone number and no text in the body
The problem with sms: urls is it seems there are 3 different options for how to add body text using
?body= ... for android and most older mobiles
Then just because Apple want to be different
iOS 5 may not work at all
;body=... for iOS 6 and 7
&body=... for iOS 8

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
This script is a test to produce a sms with a pre filled body and no number on as many devices as possible
I am interested to see if it will work on real iOS devices and others as I only have emulators

<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 href="'+url+'">Text this page to your friends</a></div>');
</script>

Copy code

See http://blog.julianklotz.de/2015/03/14/the-sms-uri-scheme/
2015-05-27 08:40 (edited 2015-05-27 12:36 by Graham ) · (1)

Online: Guests: 1