分享到微博的代码

1.新浪微博:

http://service.weibo.com/share/share.php?url=

count=表示是否显示当前页面被分享数量(1显示)(可选,允许为空)
&url=将页面地址转成短域名,并显示在内容文字后面。(可选,允许为空)
&appkey=用于发布微博的来源显示,为空则分享的内容来源会显示来自互联网。(可选,允许为空)
&title=分享时所示的文字内容,为空则自动抓取分享页面的title值(可选,允许为空)
&pic=自定义图片地址,作为微博配图(可选,允许为空)
&ralateUid=转发时会@相关的微博账号(可选,允许为空)
&language=语言设置(zh_cn|zh_tw)(可选)

例如:

href="http://service.weibo.com/share/share.php?title=全民狂欢,豪礼不停-《我们的传奇》官方活动&url=http://t.cn/R5A7JeF&pic=http://3dcq.tmsk.cn/event/dym160525/img/thumbnail.jpg" target="_blank"

2.腾讯微博:

http://share.v.t.qq.com/index.php?c=share&a=index

&title=默认的文本内容或RICH化转播时的消息体标题,RICH化时最多15个全角字符的长度
&url=转播页的url
& pic=需要转播的图片url,多张以|连接
&appkey=填写正确的appkey,转播后将显示该key的来源
&line1=消息体第一行的文字,最多15个全角字符的长度
&line2=消息体第二行的文字,最多15个全角字符的长度
&line3=消息体第三行的文字,最多15个全角字符的长度

API文档:http://dev.t.qq.com/websites/useshare?explain=1

3.人人网:

http://widget.renren.com/dialog/share?

resourceUrl=分享的资源Url
& srcUrl=分享的资源来源Url,默认为header中的Referer,如果分享失败可以调整此值为resourceUrl试试
&pic=分享的主题图片Url
& title=分享的标题
&description=分享的详细描述
API文档:http://dev.renren.com/website/?widget=rrshare&content=use

4.QQ空间:

http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?

url=分享的网址 (必须填写)
&desc=默认分享理由(可选)
&summary=分享摘要(可选)
&title=分享标题(可选)
&site=分享来源 如:腾讯网(可选)
&pics=分享图片的路径(可选)

API文档:http://connect.qq.com/intro/share/

分享到豆瓣:

http://shuo.douban.com/!service/share?

image=分享图片
&href=分享网址
&name=分享标题
&text=分享内容

API文档:http://open.weixin.qq.com/document/api/timeline/?lang=zh_CN

使用到的接口:

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=你的分享简述

3.分享到新浪微博接口:http://service.weibo.com/share/share.php?url=你的分享网址&sharesource=weibo&title=你的分享标题&pic=你的分享图片&appkey=你的key,需要在新浪微博开放平台中申请

var url = encodeURIComponent(document.location);
var title = encodeURIComponent(document.title);
var appkey = encodeURI("");
// 分享到其他网站
function shareToWeibo() {
    window.open("http://v.t.sina.com.cn/share/share.php?url=" + url + "&title=" + title);
};
function shareToQQ() {
    window.open("http://connect.qq.com/widget/shareqq/index.html?url=" + url + "&sharesource=qzone&title=" + title);
};
function shareToQzone() {
    window.open("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=" + url);
};
function shareToDouban() {
    window.open("http://www.douban.com/recommend/?url=" + url + "&title=" + title);
};
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值