前端网站分享功能的实现

前端网站分享功能的实现

分享功能,主要通过链接的形式实现,在新标签页打开链接填入分享的url和标题即可。shareUrl为分享的网址,shareTitle为分享的标题

分享到Twitter

https://twitter.com/intent/tweet?url=shareUrl&text=shareTitle

分享到facebook

http://www.facebook.com/sharer.php?u=shareUrl

分享到微博

https://service.weibo.com/share/share.php?url=shareUrl&title=shareTitle

分享到qq

https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=shareUrl&title=shareTitle

分享到微信:通过生成二维码,用户扫码再分享

参考

分享到facebook、twitter、google、youtube、instagram的分享代码?

本文为 程序员青阳 原创文章,遵循 CC BY-NC-SA 4.0 版权协议,转载请附上原文链接及本声明。

原文链接:https://heliufang.github.io/posts/e79a8d86/index.html