ricardozea
3/9/2017 - 1:45 PM

Display email address link with CSS to avoid email harvesting.

Display email address link with CSS to avoid email harvesting.

<a data-name="info" data-domain="test" data-tld="com" href="#" class="cryptedmail" onclick="window.location.href = 'mailto:' + this.dataset.name + '@' + this.dataset.domain + '.' + this.dataset.tld"></a>

<style>
  .cryptedmail:after {
    content: attr(data-name) "@" attr(data-domain) "." attr(data-tld); 
  }
</style>

<!-- 
  Taken from this answer in SO: http://stackoverflow.com/a/41566570/321555
-->