Search code examples
javascriptmailto

How can I send an email address and current url


How can I send the current URL to specific email address.

Tried this but it's opening two emails:

<a href="mailto:recruit@jnpgroup.co.uk" onclick="javascript:window.location='mailto:?subject=Website Job Application&body=Website Job URL: ' + window.location;">Click here to apply by e-mail</a>

Hope you can help


Solution

  • Of course it will open 2 emails

    First:) Due to the href attribute that browser requests when clicked automatically.

    Second:) Due to the onClick javascript event that your are processing.

    FIX: Chose any one from the above.