Pages

Friday, May 10, 2013

The Best Way to Obscure an Email Address on a Website

It still happens, you see websites listing full contact email address on their site.


E.g.
 bender@futurama.com

As a general rule of thumb, if you can plainly read your email address on a site it can be spammed!

Spamming bots can scrap your webpage/HTML quite easily.

To prove the point, here's a 1 liner you can execute from Linux/Mac OS Bash shell to just that.

The best solution is not to list your email address at all. Use a contact form. However, some users don't like filling out poorly designed forms that have too many useless fields. Moreover, user's are never sure if the form delivers and that form post or email address is active. So sometimes, the immediacy of a really email address can't be beat. 

The following Javascript code is a great way to hide your email address from being spammed on your webpage.

How to use: 
  1. Cut and paste the Javsacript below into your page where you want your clickable obscured email to appear. 
  2. Open a tab in your browser to http://www.rot13.com/index.php. Cut and paste your email address (bender@futurama.com) into the textarea. Click button to encode. Cut and replace the string add your ROT13 encrypted email address here in the Javascript file. You must keep the single quotes. 
  3. Replace xxxx with a name of user, such as Bender-The Robot that will be active email link, which will read on your site as Bender-The Robot's Mail. 
  4. You can change the text after </script> tag, but you need the closing </a> tag.

2 comments:

  1. Hi There this is great and I have used it, but what if you also want to add a subject to the obscured email when it is used?

    ReplyDelete
    Replies
    1. I have a solution here http://pastebin.com/embed_iframe.php?i=XBU253H4 . I cannot paste html in comments.

      Delete