Another creative way to prevent bots from stealing your email addresses
January 15, 2008The following code (using prototype) prevents bots stealing the emailaddresses used on your website. Instead of including the emailaddress directly, use a div with a classname where the email-address needs to be placed:
Hi Bot! My email address is <div class = "email_here"></div>!! Catch me if you can!
Then, use javascript to replace the email address after the page is loaded:
$$('.email_here').each( function(e) {
e.update('willem'+'@'+'ajaxorized.com').observe('click', function() { window.location = 'mailto:willem'+'@'+'ajaxorized.com'; }).setStyle({cursor:'pointer'});
});
Mind the concatenation that is used to prevent stealing from your javascript file. Include this piece of code in your body onload event and no bots will ever steal your email addresses again!
Add to:


if i was bot writer i would log everything that is not right email, but got ‘mailto:’ text. I think you should hide that(even be adding it char by char, but simple encription would be much more cool)
Comment by raveman — January 15, 2008 @ 9:13 pm
Hi Raveman,
You’re right, to trick the bots you can be as creative as you want to be. Something like this will mislead the bots as well:
‘:otliam’.split(”).reverse().join(”);
It splits :otliam into an array, reverses the chars and joins it.
Comment by Willem — January 16, 2008 @ 1:38 am
When I’m not lazy I use something like this:
e(’user’,'domain.com’);
function e(u,d) {
document.write( ‘‘ + u + ‘@’ + d + ‘‘ );
}
Comment by Sander — May 24, 2008 @ 9:28 am
Hey, nice solution. Only one thing, use a span and not a div as you are not allowed to put a block level element in a inline element and I guess you would (should) but this kind of text inside a p or something of the like.
Comment by Drewster — September 25, 2008 @ 10:21 pm