Skip navigation.

JavaScript - Anti-Spam Email Link

JavaScript - Anti-Spam Email Link

Posting a link to your email address on your website is inviting spiders to grab it and spam you.  I get around this by using a JavaScript snippet so my email address link renders on the client but not in the actual HTML source.

While I'm sure there are much better ways to do this, this has been successful for me so far.

This script creates a "mailto" link for my email address:

 <script type="text/javascript"> <!-- var name = "corey" var emailHost
= "goldb.org" document.write("<a href=" + "mail" + "to:" + name + "@" + emailHost
+ ">" + name + "@" + emailHost + "</a>") //--> </script>