问题与包含&符号的电子邮件地址中的mailto链接? [英] Issue with mailto link in email address containing ampersand?
问题描述
我有一个mailto连结,例如< a href =mailto:a& b_admin@xyz.com>
它在html上正确显示,但当我们点击链接时,outlook只显示一个地址。有人曾经遇到同样的问题,请提出建议。
编码百分比字符串是必需的IE浏览器,我假设将跨浏览器工作。从
此MSDN文档:
Windows Internet Explorer 7及更高版本。您必须对邮件地址中的所有URL保留字符进行百分比编码。例如,数字符号(#)被用作URL中的片段标识符。在处理诸如someone@example.com之类的地址时,Internet Explorer仅将数字符号部分复制到邮件客户端;包括数字符号的片段部分被忽略。这是行为设计。
所以你需要
< a href =mailto:a%26b_admin%40xyz.com>
如上所述,我预计百分比编码地址将适用于所有浏览器,但我不知道当然。我可以确认它适用于Chrome和Thunderbird。
I have a mailto link like that <a href="mailto:a&b_admin@xyz.com" >
it displays correctly on html but when we click on the link the outlook just shows a in the to address. Has anyone faced the same problem please suggest.
Percent encoding the string is required for IE and I assume will work across browsers. From this MSDN document:
Windows Internet Explorer 7 and later. You must percent-encode all URL-reserved characters within a mailto: address. For example, the number sign (#) is used as a fragment identifier in URLs. When processing an address such as some#one@example.com, Internet Explorer copies only the portion up to the number sign into the mail client; the fragment portion including the number sign is ignored. This behavior is by design.
So you need
<a href="mailto:a%26b_admin%40xyz.com">
As said, I expect a percent encoded address will work in all browsers, but I don't know for sure. I can confirm it works with Chrome and Thunderbird.
这篇关于问题与包含&符号的电子邮件地址中的mailto链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!