web-crawlerspamspam-preventionemail-spam

Protecting email addresses from spam bots / web crawlers


How do you prevent emails being gathered from web pages by email spiders? Does mailto: linking them increase the likelihood of them being picked up? Is URL-encoding useful?

Obviously the best counter-measure is to only show email addresses to logged-in users, or to provide a contact form instead of an email address. But in terms of purely client-side solutions, what is available?


Solution

  • Years later, I've created the following jQuery for a different website:

    $(".email").each(function() {
        $(this).html( $(this).html().replace("...", "@").replace(/\.\.\./g, ".") );
        $(this).attr( "href", $(this).attr("href").replace("...", "@").replace(/\.\.\./g, ".") );
    });
    

    Emails are then written as:

    <a href="mailto:bob.smith...example...com" class="email">bob.smith...example...com</a>
    

    It's not perfect, but it's very simple and seems to thwart most email harvesters. The advantage to this method is that someone not using JavaScript will probably be able to work out what the actual email address is.


    Check out this study on various email obfuscation methods.