Home   Assembler  Javascript    

Generated Javascript Mailto Tag 
(Prevent email spiders and harvestors grabbing your email ids)


Be very wary of mailto tags as sites get spidered by email harvesters. I know because I was naive enough to try unprotected mailto tags, way back in 1997, when I setup my original personal home pages putting up all our family email ids including a joke one for my dog on his page.

Three months later he was the first one in the family to get a junk email and it was from a pet company trying to sell him an aquarium !

Gradually the volume of junk emails built up.

So I tried putting %20 (which resolves to a blank) in front and behind our email-ids, and then we started getting emails addressed to 20username@abc.my-isp-for-testing.co.uk etc.,
(domain name invented to prevent this plain text id being used !)
so I knew these were originating from mail harvesters that did not understand that %20 was an escape sequence for a blank.


If you do really want to use the mailto tag then one possible solution is wrap it up in Javascript such as the following example

Put the following in your head statement

<script language="JavaScript" >
function InsertMailToTag( userName, domainName)
var EmailId;
var atSign = "&#64;"
var fullStop = "&#46";

EmailId = userName;
EmailId = "" + EmailId + atSign; 
EmailId = EmailId + domainName;

document.write( "<a href='mail" + "to:" + EmailId + "'>" + EmailId
+"</A>" );

and put the following in your HTML instead of a mailto tag
<script language="JavaScript" >
InsertMailToTag("John.Smith", "ourowndomain.com");


So there is no explicit mailto or @ sign in this code so a straight text scan would not find any give-away indications.

This is not perfect but will probably stop most email address harvesters from grabbing email-ids.

The above technique assumes that people visiting your site will have Javascript enabled but it is rare for people to have a browser that does not have Javascript enabled.