Zyra's front page //// HTML/JAVA Tricks etc //// anti-spam measures //// Site Index

e-mail address hiding method*

This is a Javascript trick which is designed to fox the spam-bots and prevent your e-mail address from being harvested. Thanks to Ernie for sending it in!

You can perform this trick and hide your e-mail address on your website regardless of what kind of computer you have, so no problems whether it's a Mac or Linux or one of the many variants of Microsoft, as it's a matter of do-it-yourself web source editing rather than a program which you install.

People wishing to send you e-mail must have computers which have JavaScript. That's Most computers, but not all. So, an extra (human-based) alternative should be provided (which in this explanation also helps to illustrate the method)!

The reason why this is worth doing is because if you just put a "mailto" link on your website, robots will harvest your address and you'll receive all sorts of SPAM! However, with this method, the robots will be confused and will most likely not understand the address. In contrast, humans using browsers will be able to e-mail you.

It's a bit like, rather than saying "I live at house number 66 on the Relief Road", saying "I live at 'clickety-click' on the road which the council named to commemorate the battle of Mafeking".

How to do it:

Supposing your e-mail address was:


Then instead of putting:

To e-mail me, <a href="mailto:myname@myowndomain.net">click here</a>

Put instead:

<p>To e-mail me, <a href="javascript:window.location='mai'+'lto:'+'myn'+'ame'+'@'+'myow'+'ndom'+'ain'+'.net'" onmouseover="window.status='You can click here to send me e-mail!';return true;" onmouseout="window.status=' ';return true;">click here</a>

Of course you can copy this and you have to customise the address to match your own address, slice it up ad-lib, and TEST IT to make sure it works! You can also customise the wording of the text, according to taste.

The result:

To send me e-mail, you can click here

This is a real e-mail address link, so if you want to send me a friendly message, please do. I'll probably reply and ask you if you'd like to receive the newsletters from this site www.zyra.org.uk (see info on this at the page about the circular newsletters). However, as robots will hopefully be confused by the Javascript, the amount of SPAM arriving to my address here should be minimal.


As not everyone has a computer with Javascript, it's best to offer a human-readable alternative. You should always include an alternative, so as to maintain your AnyBrowser-compatible status. Here's an example of the sort of thing:

To e-mail me, please send to the e-mail address "shush" followed by an "@" symbol followed by "zyra.org.uk"

Another alternative:Most Humans can read this, but most robots find difficulty!

Use a fuzzy JPG image which is human-readable but would be a huge challenge for robots to read! However, to be friendly to blind people, you have to include a cryptic text description of the same info!

A different approach:

There's a different way of not being an easy target for spam-bots, as seen at the e-mail page, and although it confuses bots and yet is compatible with all standard computers, it's a bit drastic, and also requires an infinite e-mail facility. However, it has the advantage of being able to embarrass indiscriminate spam list users and to hit back at some types of spam harvesting systems!

Other methods:

A simple e-mail encoding system which replaces the characters of the e-mail link with ascii numbers. See http://linuxtech.com/www-email.html

Extra note:

The Javascript method is not perfect, and there may be a new breed of spam-bots which could harvest the addresses. However, as you'll be getting less spam, you'll have more time to report the offenders to spam abuse lines. Plus, there are even more confusing systems which can be used for hiding e-mail addresses. This is just a start!