Using JavaScript to Display E-Mail Addresses

I like to include email addresses in blog posts so that people can contact me with questions, comments, etc. However, I don't like how posting my email address seems to invite a flood of email spam. Here is how to use JavaScript in blog posts in order to get around this dilemma.

When I use an e-mail address in my blog - e.g. (not a real email address by the way)- that is a nice way to make it possible for people to contact me. I've had more than one past friend or colleague come across one of my blog or websites, find my email address on a "contact" page, and send me an e-mail to re-introduce themselves.

What isn't so nice is that spammers do the same thing. They run 'bot software that scans blogs, sites, etc. looking for e-mail addresses to start spamming. Boo. Hiss.

One way people get around this is by trying to publish their email addresses in such a way that the spam 'bots won't pickup the email address but a person will. A common form of this is to replace something like with brian(at)blawler(dot)com. That works pretty well but has a couple of problem. First, 'bots seem to be always be getting smarter about picking out that syntax and capturing those email addresses anyway. Second, my less computer literate friends and relatives won't always get how brian(at)blawler(dot)com should be entered into their email programs as

If you don't mind working in the HTML that makes your blog posts possible (and your blog system allows this - Blogger does), then you can improve things just a little bit by using JavaScript.

Using JavaScript, I can display something like this...


by using HTML and JavaScript code that looks like this...

<span style="color:green;"> <script type="text/javascript">

Try this and you'll be able to display an email address that are easy to for your friendly blog readers to understand but not so easy for spammers to pickup.

No comments: