http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript">
wx.config({
debug: false,
appId: '',
timestamp: 1460701064,
nonceStr: '',
signature: '',
jsApiList: [
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareWeibo'
]
});
wx.ready(function () {
var shareData = {
title : '',
content : '',
imageUrl : '',
link : ''
};
var shareToTimeline = function() {
wx.onMenuShareTimeline({
title : shareData.content,
link : shareData.link,
imgUrl : shareData.imageUrl
});
};
var shareToAppMessage = function() {
wx.onMenuShareAppMessage({
title : shareData.title,
desc : shareData.content,
link : shareData.link,
imgUrl : shareData.imageUrl,
type : '', // 分享类型,music、video或link,不填默认为link
dataUrl : '' // 如果type是music或video,则要提供数据链接,默认为空
});
};
var shareToWeibo = function() {
wx.onMenuShareWeibo({
title : shareData.title, // 分享标题
desc : shareData.content, // 分享描述
link : shareData.link, // 分享链接
imgUrl : shareData.imageUrl // 分享图标
});
};
function share() {
shareToTimeline();
shareToAppMessage();
shareToWeibo();
}
share();
window.setShareData = function(data) {
shareData['title'] = data['title'];
shareData['content'] = data['content'];
shareData['imageUrl'] = data['imageUrl'];
share();
};
});
</script>
微信移动客户端内部浏览器分享到朋友圈,QQ空间代码
最新推荐文章于 2022-02-14 17:09:48 发布