For many webmasters this method is the best anti-harvester solution, being a compromise between usability, effectiveness and ease of setup. To implement it, you need to copy a few lines of JavaScript code into your HTML and change the address to your own.

This method does actually place an email hyperlink on the page, just like a normal email link. The user won't know the difference. It looks like this:

The trick is that instead of spelling out the email link using standard HTML, it is converted into JavaScript code and only "decoded" by a JavaScript-enabled browser. This brings us to the main disadvantage: If the user has JavaScript disabled the link won't work — this could affect up to 5% of your visitors.

Below is an example of a simple harvester-foiling script. If you are familiar with JavaScript you'll see that this script simply divides the address into two parts ("nospam" and ""), then puts the parts back together when the user opens the page.

Copy this code into your HTML where you want the link to appear. Make sure you change "nospam" and "" to match your own address.

<script language="JavaScript" type="text/JavaScript">
var em1 = "nospam"
var em2 = "@"
var em3 = ""
document.write('<a href=\"mailto:' + em1 + em2 + em3 +'\">Click here to email me</a>');

Technically speaking, your email address is still visible in the source code but it's unlikely that any harvester will recognize it.

For Advanced Users

The following example uses a function to make displaying multiple email addresses more efficient. The function needs to be included once, either in the web page's head or an external JavaScript file:

// Hide Email Addresses from Harvesters
function hideaddy(em1, em2, atxt) {
if (em1 && em2) {
if (!atxt) { var atxt = "E-Mail"; }
document.write('<a href=\"mailto:' + em1 + '@' + em2 +'\">' + atxt + '</a>');
} else {
document.write(' -- No email address supplied -- ');

The following code is then used to display each email address on the page:

< script language="JavaScript" type="text/JavaScript" >
hideaddy('nospam', '', 'Click here to email me');
</ script >

It should be fairly obvious how the format works. The anchor text is optional — if not defined it will say "E-Mail".

Next page: Using a Contact Form

Subscribe to us on YouTube