4/22/2008

Spam-Proof Your Email Address Through Javascript

Nobody likes placing their email address directly on a page because of spam bots crawling their site trying to find one. I recently had to place an email address on a page and found a workaround, where you can add your email address and hide it from spam bots at the same time. Its a javascript workaround and since spam bots are too lazy to read javascript, your email address is safe and hidden away, while you can read it perfectly fine. Here's the code:

<script type="text/javascript">
<!--
address=('you' + '@' + 'domain.com')
document.write('<a href="mailto:' + address + '">' + address + '</a>')
//-->
</script>

Swap out the variables for your information, and you're done. Spam-proof email address. Of course, you need javascript enabled to see it.

3 comments:

Adam Polselli said...

Thanks for this tip! I've been looking for something like this for a while.

ilker said...

Excellent, thanks! =)

Andrew Sims said...

Thanks! I've been getting spammed out at my blogs email address. I found your site through bountee and here is my reward! Also the cool stuff you do. Kudos on the Stevie!

Andy
KSCHHH.com