前几天做一个页面分享的功能,平常我们都是做微信分享的,提供了jssdk,但是这次是在默认的浏览器上分享到微博,在iPhone手机上浏览器可以直接分享到微信或微博平台。
但是这次我们要自己用平台提供的jscallback来做,下面贴出几个这几个链接
微博
let params = `title=${encodeURIComponent(title)}&url=${encodeURIComponent(url)}&content=utf8&sourceUrl=${url}&pic=${picurl}`let sharesinastring =`https://v.t.sina.com.cn/share/share.php?${params}`window.open(shareqqzonestring, 'newwindow', 'width=300,height=400,left=100')
qqzone
let params = `title=${encodeURIComponent(title)}&summary=${encodeURIComponent(title)}&url=${encodeURIComponent(url)}&pics=${picurl}`let shareqqzonestring = `https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?${params}`window.open(shareqqzonestring,'newwindow','width=300,height=400,left=100')
let parmas = `title=${encodeURIComponent(title)}&url=${encodeURIComponent(url)}&source=${url}&desc=${encodeURIComponent(title)}&pics=${picurl}&summary=${desc}`let shareqq =`https://connect.qq.com/widget/shareqq/index.html?${params}`window.open(shareqq,'newwindow','width=300,height=400,left=100')
以上是分享 内容,在某些手机浏览器可能有兼容性问题,比如登录失败遇到过几次,但过几天又好了,至今没得出什么规律,需要注意的是在分享的url尽量不要带参数,如果带参数加encodeURIComponet也可以解决,