创建 Gmail 共享链接 [英] Create a Gmail share link
问题描述
我想在我的单页网络应用程序上放置一个按钮,允许用户通过 Gmail 发送链接.我发现有些网站(例如 addthis.com)提供了这样的按钮,但是该按钮会自动使用 url 栏中的链接.由于我有一个单页 Web 应用程序,因此 url 栏中的链接将始终相同.我需要能够自己将链接放入按钮中(例如,可以使用 Facebook 和 Twitter 共享按钮).
I would like to put a button on my one page web application that allows a user to send a link through Gmail. I found that some websites such as addthis.com provide such a button, however this button automatically uses the link from the url bar. Since I have a one page web application the link in the url bar will always be the same. I need to be able to to put the link in the button myself (which is possible with, for example, the Facebook and Twitter share buttons).
如何创建可用于共享链接的 Gmail 按钮?
How can I create a Gmail button that can be used to share a link?
谢谢.
推荐答案
On Button 点击编写一个函数并在函数内部执行此操作
On Button click write a function and do this inside the function
let url = 'https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=&su=Your+Subject+here&body='+msgbody+'&ui=2&tf=1&pli=1';
window.open(url, 'sharer', 'toolbar=0,status=0,width=648,height=395');
该 url 将生成一个链接以打开带有自动填充主题的 gmail 选项卡,您可以在 msgbody 的位置输入您想要分享的 url.
The url will generate a link to open a gmail tab with auto filled subject and in in place of msgbody you can put your url you want to share.
这篇关于创建 Gmail 共享链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!