Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts

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.