首页 > 代码库 > [转]微信转载朋友圈时的窗口自定义及回调

[转]微信转载朋友圈时的窗口自定义及回调

From : http://blog.csdn.net/liangpei2008/article/details/19980093

var dataForWeixin={   appId:"xxxxxxxxx",   MsgImg:"转发时的图片",   TLImg:"图片",   url:"自定义链接",   title:"自定义标题",   desc:"自定义描述",   fakeid:"",   callback:function(    //这里是分享成功后的回调功能   ){}};(function(){   var onBridgeReady=function(){   //发送给朋友   WeixinJSBridge.on(‘menu:share:appmessage‘, function(argv){      WeixinJSBridge.invoke(‘sendAppMessage‘,{         "appid":dataForWeixin.appId,         "img_url":dataForWeixin.MsgImg,         "img_width":"120",         "img_height":"120",         "link":dataForWeixin.url,         "desc":dataForWeixin.desc,         "title":dataForWeixin.title      }, function(res){(dataForWeixin.callback)();});   });   //发送到朋友圈   WeixinJSBridge.on(‘menu:share:timeline‘, function(argv){            WeixinJSBridge.invoke(‘shareTimeline‘,{         "img_url":dataForWeixin.TLImg,         "img_width":"120",         "img_height":"120",         "link":dataForWeixin.url,         "desc":dataForWeixin.desc,         "title":dataForWeixin.title      }, function(res){(dataForWeixin.callback)();});});   //分享到微博   WeixinJSBridge.on(‘menu:share:weibo‘, function(argv){      WeixinJSBridge.invoke(‘shareWeibo‘,{         "content":dataForWeixin.title,         "url":dataForWeixin.url      }, function(res){(dataForWeixin.callback)();});   });   //分享到facebook   WeixinJSBridge.on(‘menu:share:facebook‘, function(argv){      (dataForWeixin.callback)();      WeixinJSBridge.invoke(‘shareFB‘,{         "img_url":dataForWeixin.TLImg,         "img_width":"120",         "img_height":"120",         "link":dataForWeixin.url,         "desc":dataForWeixin.desc,         "title":dataForWeixin.title      }, function(res){});   });};if(document.addEventListener){   document.addEventListener(‘WeixinJSBridgeReady‘, onBridgeReady, false);}else if(document.attachEvent){   document.attachEvent(‘WeixinJSBridgeReady‘   , onBridgeReady);   document.attachEvent(‘onWeixinJSBridgeReady‘ , onBridgeReady);}})();

http://bbs.blueidea.com/thread-3103040-1-1.html

http://www.baidu.com/s?ie=utf-8&f=3&rsv_bp=1&tn=baidu&wd=weixinjsbridge.invoke%20sendappmessage&rsv_enter=1&rsv_sug3=1&rsv_sug4=45&rsv_sug1=1&oq=sendAppMessage&rsv_sug2=1&rsp=0&inputT=4729

[转]微信转载朋友圈时的窗口自定义及回调