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.