mikeage.net Logo

mikeage.net @ ט״ז מרחשון תשפ״ב

Posts Tagged ‘JavaScript’

Hiding E-Mail addresses with JavaScript

‍‍ז׳ מנחם אב תשס״ה - Friday, August 12th, 2005

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 />

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.


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): 2783264/2793216