<a href="javascript:void(0)" id="share">发送给好友</a>
<script type="text/javascript">
var readyFunc = function onBridgeReady() {
document.querySelector('#share').addEventListener('click', function(e){
WeixinJSBridge.invoke('sendAppMessage',{
"img_url":"http://www.sample.com//img/template/lib/home-450300.jpg?v=2013-12-18-2?=2013-12-18-2",
"img_width":"640",
"img_height":"640",
"link":"http://www.sample.com",
"desc":'desc',
"title":'title'
},function(res){
alert(res.err_msg);
});
});
}
if (typeof WeixinJSBridge === "undefined") {
document.addEventListener('WeixinJSBridgeReady', readyFunc, false);
} else {
readyFunc();
}
</script>
点击发送给好友后提示system:access_denied
只能手动点击右上角的分享才可以触发