Issue with mailto link in email address containing ampersand?

旧巷老猫 提交于 2019-12-01 14:29:28

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/9498225/issue-with-mailto-link-in-email-address-containing-ampersand

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!