Spam-safe mailto without images

By Bobby Whitman

Every web developer should be well aware that if your e-mail address appears on your website in text, you should expect an increase in spam. To thwart spammers you will often see e-mail addresses placed in images to be displayed on the web. I used to do it this way myself, but recently I have shifted to a method that is much easier implement and should work just as well.

The solution: use JavaScript. By using a programming language like JavaScript to build a string and display it, evil spamming robots can scrub my site all they’d like and never find my e-mail address in the code.

<a href=”javascript:location.href = ‘ma’ + ‘i’ + ‘lto:b’ + ‘ob’ + ‘b’ + ‘y@’ + ‘d’ + ‘y’ + ‘na’ + ‘mi’ + ‘t.u’ + ‘s’;”><script type=”text/javascript”>document.write(‘b’ + ‘ob’ + ‘b’ + ‘y&’ + ‘#’ + ’64;d’ + ‘y’ + ‘na’ + ‘mi’ + ‘t.u’ + ‘s’);</script></a>

Leave a Reply