[英]Javascript - save clickable link in string
So I have function like this which is called on button
click: 所以我有这样的功能,在单击
button
被称为:
function sendEmail() {
var subject = 'test subject';
var href = window.location.origin + window.location.pathname;
var body = 'test body: ' + href;
window.location.href = 'mailto:?subject=' + subject + '&body=' + body;
}
Is it possible to save this href
in email body as a real link not as a string
?? 是否可以将此
href
保留为电子邮件的真实链接而不是string
?
Thanks for any suggestions. 感谢您的任何建议。
不,不可能像这样实现,因为此处正文应为纯文本。
You need to setup your mail function to send Content-Headers for TEXT/HTML instead of TEXT/PLAIN. 您需要设置邮件功能以发送TEXT / HTML的Content-Header,而不是TEXT / PLAIN。
If so you can use simple html to send the mail. 如果是这样,您可以使用简单的html发送邮件。 That would make the link look like:
这将使链接看起来像:
function sendEmail() {
var subject = 'test subject';
var href = window.location.origin + window.location.pathname;
var body = 'test body: <a href="' + href + '">Any Description</a>';
}
If your solution would work it would be possible to force people to redirect to another page by reading their mails and for sure this should not be the case. 如果您的解决方案可行,则可以通过阅读他们的邮件来强迫人们重定向到另一个页面,并且可以肯定的是,情况并非如此。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.