Display an email address on a web page that cannot be copied or spammed.

Its not an easy job to hide an email address on a web-page. Spammers and hackers can obtain email addresses from a web page just by scanning the source code for the relevant markers. Even if you use Java script, the address is still in the source code and could be extracted by an automated system - and of course your code relies on the client PC having java script enabled.

Even though as a last resort you can hide or disguise an email address by simply renaming some of the key elements - ie "test at thisdomain dot com", the below example allows you to display a full email address in a document by creating an image containing the email as text.

To provide greater resilience against email harvesting scripts, the code contains 2 parts. The first part encrypts the email address and creates a valid <IMG> tag containing the link to the second part of the code which decrypts the address and displays it. This code therefore also contains a very tidy private / public key encryption class ( which I do not proclaim to have created ) which could be used in a wide number of other systems.

Obviously this code does not stop someone just reading the address and writing it down, or prevent any OCR type scanning, however, it is very handy for hiding other URLS or text which you do not want access by bots or scripts - for example a confirmation code or similar.