新浪微博分享调用

新浪微博分享

什么都不说了,直接上代码

<script type="text/javascript">
$(".icon-weibo").click(function(){
    window.sharetitle = $("h1").text(); //分享内容的标题
    window.shareUrl = window.location.href; //分享内容的链接
    share();
});
//分享至微博
function share(){
    //d指的是window
    (function(s,d,e){try{}catch(e){}var f='http://v.t.sina.com.cn/share/share.php?',u=d.location.href,p=['url=',e(u),'&title=',e(window.sharetitle),'&appkey=2924220432','&pic=',e(window.shareUrl)].join('');function a(){if(!window.open([f,p].join(''),'mb',['toolbar=0,status=0,resizable=1,width=620,height=450,left=',(s.width-620)/2,',top=',(s.height-450)/2].join('')))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})(screen,document,encodeURIComponent);
}
</script>
posted @ 2017-02-24 16:25  夜月光雾  阅读(8)  评论(0编辑  收藏  举报