js分享微信 ,微博 ,qq空间
目前pc微信分享,是通过扫描二维码进行分享
var _title,_source,_sourceUrl,_pic,_showcount,_desc,_summary,_site,
_width = ,
_height = ,
_top = (screen.height-_height)/,
_left = (screen.width-_width)/,
_url = '',
_pic = ''; //分享到新浪微博
function shareToSinaWB(event){
event.preventDefault();
var _shareUrl = 'http://v.t.sina.com.cn/share/share.php?&appkey=895033136'; //真实的appkey,必选参数
_shareUrl += '&url='+ encodeURIComponent(_url||document.location.href); //参数url设置分享的内容链接|默认当前页location,可选参数
_shareUrl += '&title=' + encodeURIComponent(_title||document.title); //参数title设置分享的标题|默认当前页标题,可选参数
_shareUrl += '&source=' + encodeURIComponent(_source||'');
_shareUrl += '&sourceUrl=' + encodeURIComponent(_sourceUrl||'');
_shareUrl += '&content=' + 'utf-8'; //参数content设置页面编码gb2312|utf-8,可选参数
_shareUrl += '&pic=' + encodeURIComponent(_pic||''); //参数pic设置图片链接|默认为空,可选参数
window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',top='+_top+',left='+_left+',toolbar=no,menubar=no,scrollbars=no, resizable=1,location=no,status=0');
} //分享到QQ空间
function shareToQzone(event){
event.preventDefault(); var _shareUrl = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?';
_shareUrl += 'url=' + encodeURIComponent(_url||document.location); //参数url设置分享的内容链接|默认当前页location
_shareUrl += '&showcount=' + _showcount||; //参数showcount是否显示分享总数,显示:'1',不显示:'0',默认不显示
_shareUrl += '&desc=' + encodeURIComponent(_desc||'分享的描述'); //参数desc设置分享的描述,可选参数
_shareUrl += '&summary=' + encodeURIComponent(_summary||'分享摘要'); //参数summary设置分享摘要,可选参数
_shareUrl += '&title=' + encodeURIComponent(_title||document.title); //参数title设置分享标题,可选参数
_shareUrl += '&site=' + encodeURIComponent(_site||''); //参数site设置分享来源,可选参数
_shareUrl += '&pics=' + encodeURIComponent(_pic||''); //参数pics设置分享图片的路径,多张图片以"|"隔开,可选参数
window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',top='+_top+',left='+_left+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
} //分享到百度贴吧
function shareToTieba(event){
event.preventDefault(); var _shareUrl = 'http://tieba.baidu.com/f/commit/share/openShareApi?';
_shareUrl += 'title=' + encodeURIComponent(_title||document.title); //分享的标题
_shareUrl += '&url=' + encodeURIComponent(_url||document.location); //分享的链接
_shareUrl += '&pic=' + encodeURIComponent(_pic||''); //分享的图片
window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',left='+_left+',top='+_top+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
} //分享到豆瓣
function shareToDouban(event){
event.preventDefault(); var _shareUrl = 'http://shuo.douban.com/!service/share?';
_shareUrl += 'href=' + encodeURIComponent(_url||location.href); //分享的链接
_shareUrl += '&name=' + encodeURIComponent(_title||document.title); //分享的标题
_shareUrl += '&image=' + encodeURIComponent(_pic||''); //分享的图片
window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',left='+_left+',top='+_top+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
}
//分享到腾讯微博
function shareToQQwb(event){
event.preventDefault(); var _shareUrl = 'http://v.t.qq.com/share/share.php?';
_shareUrl += 'title=' + encodeURIComponent(_title||document.title); //分享的标题
_shareUrl += '&url=' + encodeURIComponent(_url||location.href); //分享的链接
_shareUrl += '&appkey=5bd32d6f1dff4725ba40338b233ff155'; //在腾迅微博平台创建应用获取微博AppKey
_shareUrl += '&site=' + encodeURIComponent(_site||''); //分享来源
_shareUrl += '&pic=' + encodeURIComponent(_pic||''); //分享的图片,如果是多张图片,则定义var _pic='图片url1|图片url2|图片url3....'
window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',left='+_left+',top='+_top+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
}
//分享到开心网
function shareToKaixin(event){
event.preventDefault(); var _shareUrl = 'http://www.kaixin001.com/rest/records.php?';
_shareUrl += 'url=' + encodeURIComponent(_url||location.href); //分享的链接
_shareUrl += '&content=' + encodeURIComponent('分享的文字'); //需要分享的文字,当文字为空时,自动抓取分享网址的title
_shareUrl += '&pic=' + encodeURIComponent(_pic||''); //分享的图片,多个使用半角逗号分隔
_shareUrl += '&showcount=0'; //是否显示分享数,显示:'1',不显示:'0'
_shareUrl += '&style=11'; //显示的样式,必选参数
_shareUrl += '&aid=' + encodeURIComponent(_site||''); //显示分享来源
window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',left='+_left+',top='+_top+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
} function shareToKaixin2(event){
event.preventDefault(); var _shareUrl = 'http://www.kaixin001.com/repaste/share.php?';
_shareUrl += 'rtitle=' + encodeURIComponent(_title||document.title); //分享的标题
window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',left='+_left+',top='+_top+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
} //分享到facebook
function shareToFacebook(event){
event.preventDefault(); var _shareUrl = 'http://www.facebook.com/sharer/sharer.php?';
_shareUrl += 'u=' + encodeURIComponent(_url||location.href); //分享的链接
_shareUrl += '&t=' + encodeURIComponent(_title||document.title); //分享的标题
window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',left='+_left+',top='+_top+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
}
//分享到facebook
function shareToFacebook(event){
event.preventDefault(); var _shareUrl = 'http://www.facebook.com/sharer/sharer.php?';
_shareUrl += 'u=' + encodeURIComponent(_url||location.href); //分享的链接
_shareUrl += '&t=' + encodeURIComponent(_title||document.title); //分享的标题
window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',left='+_left+',top='+_top+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
} //分享到Twitter
function shareToTwitter(event){
event.preventDefault(); var _shareUrl = 'http://twitter.com/intent/tweet?';
_shareUrl += 'url=' + encodeURIComponent(_url||location.href); //分享的链接
_shareUrl += '&text=' + encodeURIComponent(_title||document.title); //分享的标题
window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',left='+_left+',top='+_top+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
}
http://sabrinatian.github.io/webpage-sharing/share.html
js分享微信 ,微博 ,qq空间的更多相关文章
- 《社交红利》读书总结--如何从微信微博QQ空间等社交网络带走海量用户、流量与收入
<社交红利--如何从微信微博QQ空间等社交网络带走海量用户.流量与收入>--徐志斌 著 <社交红利>这本书2013年9月才上市,卖的非常火. 我最初是在公司内部的期刊上,看到有 ...
- 分享微博,qq空间,微信
<div class="share_class" ><div class="bdsharebuttonbox"> <a hr ...
- 网站文章分享到微博,微信、qq空间--举例用织梦
有对应接口的,传递参数过去就行了,注意下面的{..},需要替换为你的内容,看参数名称你应该知道是什么东东 新浪地址接口http://service.weibo.com/share/share.php? ...
- 报bug mui分享微信 ,qq 分享失败
1. iOS分享链接到微信,分享成功,但是分享的只有title,其他参数都没有 原因是mui分享进行了更新,msg新增了 msg.type 这个配置参数 qq : msg.type='text' 微信 ...
- 自己动手写js分享插件 [支持https] (可以分享QQ空间,微信,新浪微博。。。)
由于百度分享,jiathis 等分享插件在https下均会报错,就萌生了自己动手写一个分享插件的念头,其实实现起来一点都不难,以下代码都已在https网站运行通过,特附上以下代码:还请各位看官不吝赐教 ...
- 自己动手写js分享插件 [支持https] (QQ空间,微信,新浪微博。。。)
转载:https://blog.csdn.net/libin_1/article/details/52424340 废话不多说,传送门:http://download.csdn.net/detail/ ...
- Android 调用系统分享文字、图片、文件,可直达微信、朋友圈、QQ、QQ空间、微博
原文:Android 调用系统分享文字.图片.文件,可直达微信.朋友圈.QQ.QQ空间.微博 兼容SDK 18以上的系统,直接调用系统分享功能,分享文本.图片.文件到第三方APP,如:微信.QQ.微博 ...
- js分享功能(微信,QQ,微博,空间,豆瓣等)
日常编程中,我们可能会碰到项目中的分享功能,各大平台都有分享接口和文档说明,当然也有一些一键分享插件,例如:sosh,iShare.js等等 但有些同学不想引用插件,那么我整理了一些常用的分享至平台功 ...
- js 分享QQ、QQ空间、微信、微博
//分享QQ好友 function qq(title,url,pic) { var p = { url: 'http://test.qicheyitiao.com',/*获取URL,可加上来自分享到Q ...
随机推荐
- ps怎么把一种颜色变成另一种颜色
使用软件:PS CC版 使用Photoshop 将图片中的一种颜色变成另一种颜色的两种方法: 1.打开图片,Ctrl+J复制一份: 2.执行菜单-选择-色彩范围,使用吸管和吸管+选取图片颜色部分,点确 ...
- vue -- v-model 表单绑定
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 虚拟机linux系统网络连接配置问题总结
1.虚拟机与CentOS的安装与配置参考本人博客:https://www.cnblogs.com/ClikeL/p/11743520.html 2.测试网络连接 ping www.baidu.com ...
- 10.4.3反向迭代器Reverse_iterator笔记
反向迭代器就是在容器中从尾元素向首元素反向移动的迭代器.对于反向携带器,递增(以及递减)操作的含义会颠倒过来.递增一个反向迭代器(++it)会移动到前一个元素:递减一个迭代器(--it)会移动到下一个 ...
- CentOS 7下用firewall-cmd控制端口与端口转发
# 将80端口的流量转发至192.168.0.1的8080端口 1.firewall-cmd --permanent --add-forward-port=port=80:proto=tcp:toad ...
- 【14】N的二进制中1的个数
class Solution { public int findKthLargest(int[] nums, int k) { PriorityQueue<Integer> h = new ...
- E. Pavel and Triangles dp+问题转化
E. Pavel and Triangles dp+问题转化 题意 给出n种线段,每种线段给出一定数量,其中每个线段都是 \(2^k\) 问最多能组成多少个三角形 思路 因为每个是\(2^k\)所以能 ...
- jsp页面直接读取mysql数据库数据显示
jsp页面直接读取mysql数据库数据显示: <%@page import="java.sql.ResultSet"%> <%@page import=" ...
- springboot06(静态资源映射)
xxxxAutoConfiguration xxxxproperties 对静态资源的映射规则 webjars @ConfigurationProperties(prefix = "spri ...
- 【一句话解释】docker and vm
效果 在一个host上面运行多个os,达到快速部署以及充分利用资源的额目的 vm 虚拟机,会模拟一个完整的操作系统堆栈出来. 缺点开销大,优点,guest os 是一个完整的操作系统 根据hyperv ...