Set a mailto link with a subject containing an amp

2020-03-01 03:13发布

Im using the following mailto link to send an email:

 <a class="share3" title="" href="mailto:?subject=@check&amp;body=@domain">

It works well, but sometimes my subject will contain an ampersand (&) character, and when it does my email is created without a body.

Any way to resolve this problem?

2条回答
兄弟一词,经得起流年.
2楼-- · 2020-03-01 03:52

In order to get special/reserved characters into a URL, you must encode them - to get an & to work, it must be encoded to %26.

More details here: http://www.w3schools.com/tags/ref_urlencode.asp

查看更多
The star\"
3楼-- · 2020-03-01 03:52

use %26 for the & in the subject.

查看更多
登录 后发表回答