Anti-email-harvesting with JavaScript

02 April 2004   0 comments   Web development

Powered by Fusion×

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?


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

Related posts

Metamorphosis, Franz Kafka 31 March 2004
Challenge Osama with scimitar or sword 02 April 2004
Related by keywords:
To readline() or readlines() 12 March 2004
bool is instance of int in Python 05 December 2008
Reciprocal lesson about gender perspectives 02 September 2011
Nginx vs. Squid 17 March 2009
IssueTrackerProduct now officially abandoned 30 March 2012
How and why to use django-mongokit (aka. Django to MongoDB) 08 March 2010
On the command line no one can hear you screen. Or can they? 03 May 2012
Nasty surprise of Django cache 09 December 2008
Random ID generator for Zope 02 September 2005
Google Calendar, iCalendar Validator but not bloody Apple iCal 09 April 2009
tempfile in Python standard library 07 February 2006
In Django, how much faster is it to aggregate? 27 October 2010