There are lots of times I want to put an email address on a web page, but I always fear the spam bots that harvest email addresses and clog your inbox with tons of shit about drugs and mortgages. A lot of times you’ll see people do things like write jenn y [[[ a t ]]] hack addict ((( dott ))) ne t

The thing with this is that I think most robots are smart enough to figure out that’s an email address, because there are only so many brackets and ‘at’ and ‘dot’ combinations that are commonly used. If I have to do something like that (viz. if I don’t have access to javascript), I put a bunch of garbage tags in the HTML to obscure things as much as possible:

jenn<span>y</span> <span> </span>[[[ <span> a<span>t</span> </span>]]] hack<span>addict</span> ((( dott ))) <span>ne</span>t


That’s still not an ideal solution because it’s not much harder to parse and it looks like crap to the human user. The user can’t just click on the email to send a message since there’s no mailto: link. Furthermore, the user can’t even copy and paste the email address because of all the brackets and reformatting.

My ideal solution uses javascript to create a link that is human readable, obscured pretty nicely to prevent spam robots from harvesting it, and clickable with a mailto: link. The basic idea is to mix up the email address itself in a really convoluted order, but concatenate a string in javascript that evaluates to the correct address.

<script type=”text/javascript”>

var e = “hackaddic”;

e = “@” + e;

e += “”;

e = “jenny” + e;

var nspm = “mailto”;

nspm = nspm + “:” + e;

nspm = “<a href=’” + nspm +”’ title=’Send Questions or Comments to’>Contact</a>”;

document.onload += document.write(nspm);



The above code works fine in a blogger template, a feat which took a little work to accomplish because of the way blogger checks for matching tags when it compiles your template. You can see an example of this code at the top of the page.