首页 > 代码库 > 微信里如何判断页面被分享成功

微信里如何判断页面被分享成功

var shareData = http://www.mamicode.com/{"string">"",    img_width: 200,    img_height: 200,    link: ‘‘,    desc: ‘‘,    title: ‘‘,    appid: 0};document.addEventListener(‘WeixinJSBridgeReady‘, function onBridgeReady() {    // 发送给好友    WeixinJSBridge.on(‘menu:share:appmessage‘, function(argv){        shareFriend();    });    // 分享到朋友圈    WeixinJSBridge.on(‘menu:share:timeline‘, function(argv){        shareTimeline();    }); }, false);function shareTimeline() {    WeixinJSBridge.invoke(‘shareTimeline‘, shareData, function(res) {        validateShare(res);        _report(‘timeline‘, res.err_msg);    });}function shareFriend() {    WeixinJSBridge.invoke(‘sendAppMessage‘, shareData, function(res) {        validateShare(res);        _report(‘send_msg‘, res.err_msg);    });}function validateShare(res) {    if(res.err_msg != ‘send_app_msg:cancel‘ && res.err_msg != ‘share_timeline:cancel‘) {    //分享完毕回调    }}