How to create a mailto link with an ampersand
A little challenge I came across today was including an email address in an email that contained an ampersand.
The email address looked a little like this:
The problem was that whenever I used mailto:firstname.lastname@example.org, if I then click on the link from my inbox, a new message window would appear with just an ‘a’ in the To field.
The solution to this issue was fairly simple; I just needed to replace the ampersand with its hex code, so I changed it to email@example.com.
So the full markup looked a little something like this:
<a href="mailto:firstname.lastname@example.org">Get In Touch</a>