mikeage.net Logo
mikeage.net/2005/08/12/hiding-e-mail-addresses-with-javascript/

mikeage.net @ ח׳ שבט תשע״ח

Hiding E-Mail addresses with JavaScript

Quick Overview

Many people put a link on their homepage to email them directly. This is done using a link with the form mailto:address@domain.com. The problem is that many spambots pick up on this sort of thing. This document will show how to hide an email from spambots, while displaying it to a user

How Do I?

Insert the following into your page wherever you want your email address to appear:

&lt;script type="text/javascript"&gt;<br />
&lt;!--<br />
varE=('email@' + 'domain.com')<br />
document.write(' &lt;A href="mailto:' + varE + '"&gt;' + varE +
'&lt;/a&gt;')<br />
//--&gt;&lt;/script&gt;

This prints a link dynamically, but since most spambots don't process JavaScript, they can't see it. Also note that by creating the string using varE=('email@' + 'mikeage.net'), they can't see it by looking through the source.

Enjoy.

Leave a Reply

Quick Map
Content +
Personal +
Archives +
Site Stuff +
RBS Weather +
Search +
Recent Images

Valid XHTML 1.1!
Printer Friendly Page
 

Last Modified: September 04, 2006 @ 02:11 CST

Memory(TRUE): 4194304/4194304
Memory(FALSE): 2992096/3002080