Blogless: Blog of Design Less Better.

Use Javascript to Protect your Email Address from Spambots

Spambots are getting a lot smarter at harvesting email addresses from web pages. Nobody wants spam. Hence, we need a solution that's going to simultaneously save our Inboxes and not give our readers a pain in the neck.

Putting an email address on a website is a lot trickier proposition than it used to be. These days, the web is populated with evil spambots, crawling the web and scraping email addresses off websites, which they can then use to solicit your interest in perverse sexual apparatus or imitation Rolex wristwatches.

But for those of us who are selling something, we have no choice but to provide a way for our readers to contact us. Now, in the past, many things have been done to accomplish this: overly elaborate or unnecessary contact forms, replacing part or all of an email address with an image, or munging an email address.

All three of these techniques are unsatisfactory. First, all of these techniques are often beatable by smart spambots. Second, and even more importantly, the bottom line from a usability perspective is quite simple: These strategies convolute things for users. The easiest interface element we can provide for our users is link that, when clicked, opens up a new email addressed to us in their email client.

The best solution I’ve ever seen for this, and the one I use all the time, is encoding the email address with javascript. This strategy provides several advantages:

  1. No known spambot can harvest an email address based on a random key encrypted email address.
  2. It seems quite unlikely that any will be able to any time soon.
  3. The website user gets the easiest possible experience.
  4. It is very easy to do with free online tools like this anti-spam email link obfuscator.

The one clear disadvantage is that it requires a user to have Javascript enabled in order to view your email address. Now, according to the W3C, about 95% of users have it enabled, and by all accounts that number is rising. But, nonetheless, this is a limitation.

A second disadvantage, and one that is common to all of the presented strategies, is that this is merely an attempt to fix a symptom rather than an attempt to solve the real problem of e-mail spam.

The advantage of this approach, as I see it, is that it does not do so at the expense of causing problems for innocent users.

These icons link to social bookmarking sites where readers can share and discover new web pages.
PaulJul 30, 2008

No Comments

Post a comment

  Please feel free to use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Want to know more?

You're reading BlogLESS, a thrice-weekly blog about the ethics of advertising, branding, design, social media and business. We are also fans of zen, although this itself is perhaps not so zen.