繁体   English   中英

在邮件链接的 email 正文中包含参数化的 URL

[英]Include paramerised URL in email body of a mailto link

I have a Javascript variable fullurl which is a url of the form http://example.com/page.php?id=123

我想在正文中创建一个带有此 URL 的 mailto 链接

html += '<a href="mailto:&subject=Test&body=' + fullurl +'">Click here</a> to email this link';

结果是一个 email 的主体只是http://example.com/page.php所以我想它是? 在 URL 中将其丢弃,因为它将其解释为 body 的结尾 = mailto 的一部分

您可以尝试使用 encodeURIComponent。

fullurl = encodeURIComponent("http://example.com/page.php?id=123")

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM