Anti-email-harvesting is when you, as a web developer, tries to make sure the spam bots can not scan your pages for email addresses and then bloat these email addresses with spam. There are several different ways of doing it, or should I say attempting to do it? None is perfect, otherwise we'd all know about it. For this site I use a technique described in the second part of this blog entry.

Now I've put together a little proof-of-concept by using a JavaScript again and modifying something ugly to something nice looking. The idea is that web developers have to render their HTML like this:

<span class="aeh">peter_at_peterbe_._com</span>

Note, that the class has to be "aeh" and the tag must be a span.

This page explains it further. What do you think? The rules can be changed but the effect is really good. People without Javascript support see the email address as peter_at_peterbe_._com which they'll just have to figure out just like they figured out how to disable Javascripts. And people with Javascript will see it as if it was written in clear text. Spam-bots won't see shit. Or will they?

UPDATE

I have upgraded the script a bit now so that it does complain about invalid HTML on spaces in the href attribute. It also doesn't use a span tag anymore. Just set the class aeh on the a tag. Lastly, it uses proper DOM manipulation instead of the hackish innerHTML gadget.

See it in action here



Your email will never ever be published