My capabilities as a graphic designer My portfolio of design work My approach to graphic design My laboratory - where I experiment with design A place for me to vent my thoughts
X-lab.co.uk - experimenting with design
Hide an Email Address Javascript

Contact me: dean at x-lab dot co dot uk

This is how to hide an email address using javascript. The Hide an email address javascript will help reduce the amount of unauthorised people harvesting your email address and bombarding your inbox with spam.

The email address above actually reads dean at x-lab dot co dot uk, look at the source if you don't believe me! Any robot looking to extract email addresses from web pages will pay no attention to this, it looks like any other text on a page. There is no mailto: command, nor an @ sign for the robot to pick up on.

When you wrap dean at x-lab dot co dot uk in a <span> tag using the class="change" the javascript will display the text as a working email address. It even opens an email program when clicked. People using your site will never know but your email address is actually hidden from those email address harvesting robots!

If someone views your web page without javascript enabled they will not see your email address, so what I do is add a <noscript> tag underneath the javascript which hides the email address in the source code informing them to see the address javascript must be enabled.

NB. This javascript is not fool proof if someone sees your email address online they can still take your address for spam purposes.

Hide an Email Address Javascript

Simply click inside the window below, use your cursor to highlight the javascript, and copy [Control]+C the javascript into a new file in your text editor (such as Note Pad) and save [Control+S]