&title=默认的文本内容或RICH化转播时的消息体标题,RICH化时最多15个全角字符的长度
&url=转播页的url
&pics=需要转播的图片url,多张以|连接
&summary=分享描述信息
&site=分享来源 如:腾讯网(可选)
&desc=默认分享理由(可选)
&appkey=填写正确的appkey,转播后将显示该key的来源
&line1=消息体第一行的文字,最多15个全角字符的长度
&line2=消息体第二行的文字,最多15个全角字符的长度
&line3=消息体第三行的文字,最多15个全角字符的长度
1.分享到QQ空间接口:https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=你的网址&sharesource=qzone&title=你的分享标题&pics=你的分享图片&summary=你的分享描述信息
2.分享给QQ好友接口:http://connect.qq.com/widget/shareqq/index.html?url=你的分享网址&sharesource=qzone&title=你的分享标题&pics=你的分享图片地址&summary=你的分享描述&desc=你的分享简述
http://service.weibo.com/share/share.php?url=
count=表示是否显示当前页面被分享数量(1显示)(可选,允许为空)
&url=将页面地址转成短域名,并显示在内容文字后面。(可选,允许为空)
&appkey=用于发布微博的来源显示,为空则分享的内容来源会显示来自互联网。(可选,允许为空)
&title=分享时所示的文字内容,为空则自动抓取分享页面的title值(可选,允许为空)
&pic=自定义图片地址,作为微博配图(可选,允许为空)
&ralateUid=转发时会@相关的微博账号(可选,允许为空)
&language=语言设置(zh_cn|zh_tw)(可选)
1.分享到新浪微博接口:http://service.weibo.com/share/share.php?url=你的分享网址&sharesource=weibo&title=你的分享标题&pic=你的分享图片&appkey=你的key
https://www.douban.com/share/service?url=
image=分享图片
&url=分享网址
&name=分享标题
&text=分享内容
1.分享豆瓣:https://www.douban.com/share/service?url=你的分享网址&name=分享标题&text=分享内容
https://zixuephp.net/inc/qrcode_img.php?url=你的分享网址
https://i.youku.com/
分享到:
function shareTo(types) {
var title, imageUrl, url, description, keywords;
//获取文章标题
title = document.title;
//获取网页中内容的第一张图片地址作为分享图
imageUrl = document.images[0].src;
// imageUrl = document.getElementById("pcdetails").getElementsByTagName("img")[0];
//当内容中没有图片时,设置分享图片为网站logo
if (typeof imageUrl == 'undefined') {
imageUrl = 'https://' + window.location.host + '/static/images/logo.png';
} else {
imageUrl = imageUrl.src;
}
//获取当前网页url 这个地方根据你的页面来
// url = document.location.href;
url = 'feisu.com';
//获取网页描述
description = document.querySelector('meta[name="description"]').getAttribute('content');
//获取网页关键字
keywords = document.querySelector('meta[name="keywords"]').getAttribute('content');
//qq空间接口的传参
if (types == 'qzone') {
window.open('https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=' + url + '&sharesource=qzone&title=' + title + '&pics=' + imageUrl + '&summary=' + description, '', 'width=800,height=650,top=100,left=15');
}
//新浪微博接口的传参
if (types == 'sina') {
window.open('http://service.weibo.com/share/share.php?url=' + url + '&sharesource=weibo&title=' + title + '&pic=' + imageUrl + '&appkey=2706825840', '', 'width=800,height=650,top=100,left=15,toolbar=no, menubar=no, scrollbars=no, resizable=no');
}
//qq好友接口的传参
if (types == 'qq') {
window.open('http://connect.qq.com/widget/shareqq/index.html?url=' + url + '&sharesource=qzone&title=' + title + '&pics=' + imageUrl + '&summary=' + description + '&desc=' + keywords, '', 'width=800,height=650,top=100,left=15,toolbar=no, menubar=no, scrollbars=no, resizable=no');
}
//生成二维码给微信扫描分享
if (types == 'wechat') {
//在线二维码生成只支持小批量调用,过多访问会限制403.
// https://zixuephp.net/inc/qrcode_img.php接口参数:url:二维码内容,size:二维码图片大小值1-10
window.open('https://zixuephp.net/inc/qrcode_img.php?url=' + url, '', 'width=800,height=650,top=100,left=15,toolbar=no, menubar=no, scrollbars=no, resizable=no');
}
// 豆瓣网
if (types == 'tudou') {
//在线二维码生成只支持小批量调用,过多访问会限制403.
// https://zixuephp.net/inc/qrcode_img.php接口参数:url:二维码内容,size:二维码图片大小值1-10
window.open('https://www.douban.com/share/service?url=' + url, '', 'width=800,height=650,top=100,left=15,toolbar=no, menubar=no, scrollbars=no, resizable=no');
}
}