I'm trying to create a mailto link that programmatically includes the current domain in the mail subject when clicked.
This is what I have so far:
<div class="cta">
Make an enquiry at <a href="javascript:'mailto:sales@hashimaziz.com?subject=Sales%20Inquiry%20RE:%20' + window.location.hostname;">sales@hashimaziz.com</a>
</div>
The JavaScript itself seems to work, but when the mailto link is clicked, it goes to a white page that prints the text of the mailto
command itself. This can be tested on the website itself here.
What's wrong with the mailto
link that's preventing it from behaving as it should?