700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > 将网页分享至QQ或QQ空间

将网页分享至QQ或QQ空间

时间:2021-04-20 08:42:02

相关推荐

将网页分享至QQ或QQ空间

1、放置分享按钮

<button onclick='ShareUtil.shareToQQ({url: "",title: "",summary: "",desc: "",pics: ""})'></button>

2、核心JavaScript

<script>var ShareUtil = {openShareUrl: function (url) {var a = document.createElement("a");a.href = url;a.target = "_blank";a.click();},shareToQQ: function (option) {var url = "/widget/shareqq/index.html" +"?url="+ encodeURIComponent(option.url)+"&title=" + encodeURIComponent(option.title) +"&source=" + encodeURIComponent('这里是你的网站首页地址') +"&summary=" + encodeURIComponent(option.desc)+"&pics=" + encodeURIComponent(option.pics)+"&desc=" + encodeURIComponent(option.summary);ShareUtil.openShareUrl(url);},shareToQZone: function (option) {var url = "https://sns./cgi-bin/qzshare/cgi_qzshare_onekey" +"?url="+ encodeURIComponent(option.url)+"&title=" + encodeURIComponent(option.title) +"&summary=" + encodeURIComponent(option.desc)+"&desc=" + encodeURIComponent(option.summary) +"&site=" + encodeURIComponent('这里是你的网站首页地址')+"&pics=" + encodeURIComponent(option.pics);ShareUtil.openShareUrl(url);}}</script>

3、参数说明

1)shareToQQ:

2)shareToQZone:

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。