Javascript Email Address Obfuscation
How to Hide Your Address
We all need to better protect our email
addresses. Spam robots and other agents crawl the web looking for
exposed mailto links and other email addresses in the clear. One way
to hide your address is to use javascript to encode your email
addresses. Although this may only slow down the robots, it seems to
be currently effective (July 2006).
So make it work, you put a script into your page (usually in
<head>) and then use the script when you want to spit out a
mailto: link. The script is:
<script language="JavaScript">
<!--
function myMailto(user, host) {
e = user + "@";
for (i = 0; i < host.length - 1; i++) { e = e + host[i] + "."; }
e = e + host[host.length - 1] ;
document.writeln("<a href='mailto:" + e + "'>" + e + "</a>");
}
-->
</script>
when you want to use it, you call it like:
<script language="JavaScript"> myMailto("foo", [ "bar","com" ]); </script>
This generates:
NOTE: It may be only a matter of time until the spam harvesters
start processing javascript.
For more details, see the pages on how to protect
your email address.
Please consider donating money to the
cause, putting a link to us on your page,
and spreading the word about MailNull.
Copyright 2006 by Gray Watson
This page is W3C Valid
XHTML.
http://mailnull.com/protect/javascript_email_obfuscation.shtml
MailNull Domain Names
Memory Debug Library
$100+ Million Sweepstakes
Your host:
(none)
38.103.63.59:44525
Agent: CCBot/1.0 (+http://www.commoncrawl.org/bot.html)
|