实现代码如下:

一、Html代码

<a href="javascript:;" class="xq-sms">发送短信</a>

二、jQuery代码

$(document).ready(function(){
var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1;
var isIos = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
var current_url = window.location.href;
if(isAndroid == true){
$(".xq-sms").attr("href","sms:?body="+current_url);
}
else if(isIos == true){
$(".xq-sms").attr("href","sms:&body="+current_url);
}
});
05-11 17:02