2014/7/18 试了一下,居然需要付费认证后才能用网页授权分享页面。。。。。。
来源:
一,http://blog.youkuaiyun.com/qq1355541448/article/details/30221215
把这段js粘贴进,设置可以分享的页面,当微信打开,即可微信进行分享各个圈
$(function(){
var lujing=$("#logimg").attr("src"); //分享中带有的图片
var url=window.location.href; //分享页的地址
var title=document.title; //分享内容的标题
weixin("http://m.e-iot.com/images/bg.jpg",url,title);
});
function weixin(a,b,c){
document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
window.shareData = {
"imgUrl": a,
"timeLineLink": b,
"sendFriendLink": b,
"weiboLink": b,
"tTitle": c,
"tContent": "8+1互助平台---营销型网站互助分享会",
"fTitle": c,
"fContent": "8+1互助平台---营销型网站互助分享会",
"wContent": "8+1互助平台---营销型网站互助分享会"
};
// 发送给好友
WeixinJSBridge.on('menu:share:appmessage', function (argv) {
WeixinJSBridge.invoke('sendAppMessage', {
"img_url": window.shareData.imgUrl,
"img_width": "640",
"img_height": "640",
"link": window.shareData.sendFriendLink,
"desc": window.shareData.fContent,
"title": window.shareData.fTitle
}, function (res) {
_report('send_msg', '111111');
})
});
// 分享到朋友圈
WeixinJSBridge.on('menu:share:timeline', function (argv) {
WeixinJSBridge.invoke('shareTimeline', {
"img_url": window.shareData.imgUrl,
"img_width": "640",
"img_height": "640",
"link": window.shareData.timeLineLink,
"desc": window.shareData.tContent,
"title": window.shareData.tTitle
}, function (res) {
_report('timeline', res.err_msg);
});
});
// 分享到微博
WeixinJSBridge.on('menu:share:weibo', function (argv) {
WeixinJSBridge.invoke('shareWeibo', {
"content": window.shareData.wContent,
"url": window.shareData.weiboLink
}, function (res) {
_report('weibo', res.err_msg);
});
});
}, false)
}
二,http://www.5icool.org/a/201308/a2297.html
下面是代码(相关参数请自行修改):
function WeiXinShareBtn() { if (typeof WeixinJSBridge == "undefined") { alert("请先通过微信搜索 wow36kr 添加36氪为好友,通过微信分享文章 "); } else { WeixinJSBridge.invoke('shareTimeline', { "title": "36氪", "link": "http://www.36kr.com", "desc": "关注互联网创业", "img_url": "http://www.36kr.com/assets/images/apple-touch-icon.png" }); } }
值得注意的是,这个按钮如果不是在微信内置浏览器中打开,点击后是没办法分享的。但是可以设置一个小弹窗