在安卓 App 分享的时候会调用 toptodayandroid 这个函数
<script type="text/javascript">
var u = navigator.userAgent, app = navigator.appVersion;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
var isiosapp = u.indexOf('Safari') == -1 && u.indexOf('Language') == -1 && u.indexOf('MicroMessenger') == -1;
var isanapp = u.indexOf('igetapp') > -1;
//判断该页面是否在微信上?
function is_weixn(){
var ua = navigator.userAgent.toLowerCase();
if(ua.match(/MicroMessenger/i)=="micromessenger") {//alert(1);
return true;
} else {//alert(2)
return false;
};
};
function toptodayandroid(top){
var bt = "共读训练营";
var fb = "我参加了今今乐道共读训练营,快和我一起读书吧";
var pic = "https://guzhanfang.oss-cn-beijing.aliyuncs.com/action/share.jpg";
var thisURL = document.URL;
//alert(top);
isinApp = true;
isinandroidapp = true;
var bb = top;
$(".bbh_p").text(bb);
if(bb>=43){
function chc(){
window.local_obj.getShareInfo(bt,fb,pic,thisURL);
};
chc();
};
};
//ios显示分享按钮
if(isiOS&&isiosapp){
$('.invite').click(function(){
//判断选择的哪个
window.location = "share://share_text";
});
$('.share').click(function(){
//判断选择的哪个
window.location = "share://share_text";
});
};
</script>