Award Sites!  ... "Bettering the Internet Experience!"

Cemetery Woods by David G. Bancroft

AIT Web Hosting and Domains ... Veteran Supported

Home | Articles | Exemplary | Achievement | NovaSite
Resources |
Tutorials | Web Awards | Contact | CureNow
SEARCH | Assembly ||
USA Patriotism! | Poetry Galore

Approved Web Hosting Companies

Gold Stars of Excellence by Award Sites!

HTML Tutorial

Using ASCII Codes with Javascript to Stop Email Harvesters

Email harvesters are designed to work as fast and as efficiently as they can. They are not designed to look for every possible way of encoding and email address. They look for the most common method (name@domain.com) and try and harvest all the email addresses that they can find on a page. So how do you avoid having your email address harvested and keep it on the page. The answer is really simple. A combination of ASCII Codes and Javascript.

The Process

The first thing that you want to do is convert all the elements of your email address into ASCII Codes. This will make the harder to recognize. They will still be viewable in a browser but the email harvests will not know that they are email addresses. They will be looking for something surrounding an "@" and not "@". Since the domain and the user are obscured it makes it harder to find. See table at end for codes.

The next step is to use a simple javascript to write the email address in the page. This will help to hide it from harvesters. You can assign a class to this link so that it is formatted to look right on your page or you can put the whole thing in a div and assign all the formatting there.

The Script

The first thing that you will need is a variable to hold the user. give it a name that does not reveal what it is about. Call it "a". Then you need another to hold the domain name. Call it "b". Take your name and set it equal to "a". Set your domain name equal to "b". Now all we need is a simple write statement to put it on the page. So the code will look something like this.

<script language="JavaScript"><!--
var a = "username goes here";
var b = "domain name goes here";
document.write('<a href=\"mailto:' + a + '&#64;' + b + '\">');
document.write('Webmaster' + '</a>');
--></script>

Insert the code into your page and upload the page and check to see how it looks. If all is done properly

So, your final product should look like this example below.

<script language="JavaScript"><!--
var a = "&#97;&#98;&#99;";
var b = "&#97;&#98;&#99;&#46;&#99;&#111;&#109;";
document.write('<a href=\"mailto:' + a + '&#64;' + b + '\">');
document.write('Webmaster' + '</a>');
--></script>

The Codes

CharacterASCII Code
.   period&#46;
digit 0&#48;
digit 1&#49;
digit 2&#50;
digit 3&#51;
digit 4&#52;
digit 5&#53;
digit 6&#54;
digit 7&#55;
digit 8&#56;
digit 9&#57;
- hyphen &#45;
uppercase A&#65;
uppercase B&#66;
uppercase C&#67;
uppercase D&#68;
uppercase E&#69;
uppercase F&#70;
uppercase G&#71;
uppercase H&#72;
uppercase I&#73;
uppercase J&#74;
uppercase K&#75;
uppercase L&#76;
uppercase M&#77;
uppercase N&#78;
uppercase O&#79;
uppercase P&#80;
uppercase Q&#81;
uppercase R&#82;
uppercase S&#83;
uppercase T&#84;
uppercase U&#85;
uppercase V&#86;
uppercase W&#87;
uppercase X&#88;
uppercase Y&#89;
uppercase Z&#90;
_ underscore&#95;
lowercase a&#97;
lowercase b&#98;
lowercase c&#99;
lowercase d&#100;
lowercase e&#101;
lowercase f&#102;
lowercase g&#103;
lowercase h&#104;
lowercase i&#105;
lowercase j&#106;
lowercase k&#107;
lowercase l&#108;
lowercase m&#109;
lowercase n&#110;
lowercase o&#111;
lowercase p&#112;
lowercase q&#113;
lowercase r&#114;
lowercase s&#115;
lowercase t&#116;
lowercase u&#117;
lowercase v&#118;
lowercase w&#119;
lowercase x&#120;
lowercase y&#121;
lowercase z&#122;
~ tilde&#126;

Contributor

Lawrence Davis

Lawrence Davis

"Approved" Web Hosting Companies