SafeMailTo <-

Description

SafeMailTo is a tiny piece of Javascript for stopping spam bot harvesters from obtaining your e-mail address from your homepage. The e-mail address doesn't appear anywhere in the HTML source and thus cannot be read by spam bots. It is, however, still shown in real browsers, including a mailto link.

Spam bots are automated programs that crawl the Internet looking for e-mail addresses which are then harvested and used as recipients for spam mailings. This results in the fact that you can't even put your e-mail address on your homepage anymore without risking an annoying ammount of spam. As long as your e-mail address appears in the HTML source code, you're at risk. The solution is to not list it in the sourcecode. SafeMailTo provides a way of doing this.

It works by employing 'encryption' (ROT13) to hide your e-mail address. A piece of javascript code decrypts the e-mail address and places the unencrypted e-mail address in the HTML page. This will protect your e-mail address from spambots that do not know Javascript and/or ROT13 encryption. (NOTE: ROT13 isn't real encryption, merely a simple obfuscation to prevent the literal email address from showing up in your HMTL code, where spambots will harvest it).

Details

License:Public Domain
Language:Javascript
Current status:Stable
Development activity:Finished

Usage

Put this piece of code in the head section of the page on which you want to include the e-mail address:

<script language="javascript">
  function rot13(s) {
    var n = '';
    for (i = 0; i < s.length; i++) {
      ch = s.charCodeAt(i);
      if ( ((ch>64) && (ch<78)) || ((ch>96) && (ch<110)) ) {
        ch += 13;
      } else
      if ( ((ch>77) && (ch<91)) || ((ch>109) && (ch<123)) ) { 
        ch -= 13;
      }
      if (ch == 124) {
        n = n.concat ("\n");
      } else {
        n = n.concat (String.fromCharCode(ch));
      }
    }
    return (n);
  }

  function email(emailaddress, subject) {
    var realaddress = rot13(emailaddress);
    return("<a href='mailto:"+realaddress+"?subject="+subject+"'>"+realaddress+"</a>");
  }
</script>

Next, cut and paste this piece of code at the place in your HTML page where you want your email address to appear:

<p>You may email me at 
<script language="javascript">
  email("ROT13 EMAIL ADDRESS", "About your homepage");
</script>.</p>

Now, convert your e-mail address to ROT13 by typing it in below.

Normal textROT13

Substitute the "ROT13 EMAIL ADDRESS" text in the code above with the result of the ROT13 encoding.

Copyright © Ferry Boender, 2003 - 2009 Edit Info