goldb.org home

AS OF MAY 2008, THIS BLOG IS NO LONGER BEING UPDATED.
Visit the new blog at: http://coreygoldberg.blogspot.com



 Friday, August 31, 2007

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>
#    Comments [1] |
Friday, August 31, 2007 7:53:55 PM (Eastern Standard Time, UTC-05:00)
love this work-around!!
paul danese
Comments are closed.