Skip to content

Instantly share code, notes, and snippets.

@MoOx MoOx/mailto.js
Last active Feb 21, 2019

What would you like to do?
a (really) simple way to hide mailto to bots
;[]"js-MailTo"), function(el) {
el.setAttribute("href", "mailto:" + el.getAttribute("data-mailto-user") + "@" + (el.getAttribute("data-mailto-domain") ||
<!-- will create a href="mailto:hello+from-website@{current domain}" -->
<a class="js-MailTo" data-mailto-user="hello+from-website">this is a mail to a user from this domain<a/>
<!-- will create a href="" -->
<a class="js-MailTo" data-mailto-user="hello+from-another" data-mailto-domain="">this is a mail to a user with his own domain<a/>

This comment has been minimized.

Copy link

commented Feb 24, 2014

Clever : i used to regex on the regex, but yours stays accessible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.