htmlhtml-entitiesampersand

ampersand in email address (href)


Im working with email address which has an ampersand in it, the user wants a 'contact us' link to open up a new message wit their address populated, I normally use href, but the ampersand is causing this not to work, any idea's?

here's what i have at the moment:

<a href="mailto:L&D@gha.org.uk? subject=MessageTitle&amp;" 
        style="font-family: Verdana; font-size: large; font-weight: bold; color: #800000">#GHA Organisation Development</a>

Solution

  • Use &amp; instead of plain &. Your href URL is inside HTML so it needs to be escaped properly to be valid HTML.