简体   繁体   English

“ +”登录JS mailto链接(Android和Chrome)

[英]“+” sign in JS mailto links (Android & Chrome)

my web page which has a button that opens the email client with an email message. 我的网页上有一个按钮,用于打开带有电子邮件的电子邮件客户端。
When the user clicks the button, the following script is being executed (JavaScript). 当用户单击按钮时,正在执行以下脚本(JavaScript)。

My problem is that on Android 4.4.4 and Chrome 38, the mail client (Gmail or android's default) replaces the %20 in '+' sign. 我的问题是,在Android 4.4.4和Chrome 38上,邮件客户端(Gmail或android的默认设置)替换了“ +”号中的%20。
I tried to encodeUri , encodeUriComponent and regular spaces chars but every time I get the '+' sign. 我尝试了encodeUriencodeUriComponent和常规空格chars,但是每次我得到“ +”号时。
Any idea how to remove the '+' sign for regular space chars? 知道如何删除常规空格字符的“ +”号吗?

var addresses = "";
var subject = "";
var body
try {
    subject = config['email']['subject']  ;
} catch (e) {
    subject = "I%20think%20you%20will%20like%20it";
}

try {
    body = config['email']['body'];
} catch (e) {
    body = "Visit%20this%20link:";
}
body += document.URL;
var href = "mailto:" + addresses + "?"
     + "subject=" + (subject) + "&"
     + "body=" + (body);
var a = document.createElement('a');
a.href = href;
document.body.appendChild(a);
a.click();

Same here, but it's documented at various places: 此处相同,但在不同地方都有记录:

Android Board Android板

Chromium Board 铬板

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

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