- Impact
- 1
Protect Against Spam Crawlers
How to protect your e-mail address:
This tutorial will show you how to protect your e-mail address against Spam Crawlers. If you don't already know what Spam Crawlers are, read this post by DarkDevil located here.
So, how do you protect your e-mail? Easy, it can be done with simple JavaScript - no need to use complicated Images or REMOVE text in e-mail links.
Let's take a basic example of an e-mail link to [email protected]
<A HREF="mailto:[email protected]" ALT="Mail Me!">[email protected]</A>
Now this will not work, a Spam Crawler could pick up this e-mail easily. So how would you protect the example above? Like this:
-------------------- Revised Version ----------------------
<SCRIPT LANGUAGE="JavaScript">
<!-- hide me
function mailme()
{
window.location = "m" + "a" + "i" + "l" + "t" + "o" + ":" + "me"+ "@" + "somewhere" + "." + "c" + "o" + "m";
}
//-->
</SCRIPT>
<A HREF="JavaScript:void(1)" ALT="Mail Me!" onClick="mailme()" >Mail me</A>
-------------------------------------
Pretty easy once you think about it huh?
Happy Programming!
P.S. In the second example the <A HREF> is pointing to "java script:void(1)", this was modified by the forum - in reality there are no spaces in "javascript:void(1)"
[edit]: I added the P.S.
How to protect your e-mail address:
This tutorial will show you how to protect your e-mail address against Spam Crawlers. If you don't already know what Spam Crawlers are, read this post by DarkDevil located here.
So, how do you protect your e-mail? Easy, it can be done with simple JavaScript - no need to use complicated Images or REMOVE text in e-mail links.
Let's take a basic example of an e-mail link to [email protected]
<A HREF="mailto:[email protected]" ALT="Mail Me!">[email protected]</A>
Now this will not work, a Spam Crawler could pick up this e-mail easily. So how would you protect the example above? Like this:
-------------------- Revised Version ----------------------
<SCRIPT LANGUAGE="JavaScript">
<!-- hide me
function mailme()
{
window.location = "m" + "a" + "i" + "l" + "t" + "o" + ":" + "me"+ "@" + "somewhere" + "." + "c" + "o" + "m";
}
//-->
</SCRIPT>
<A HREF="JavaScript:void(1)" ALT="Mail Me!" onClick="mailme()" >Mail me</A>
-------------------------------------
Pretty easy once you think about it huh?
Happy Programming!
P.S. In the second example the <A HREF> is pointing to "java script:void(1)", this was modified by the forum - in reality there are no spaces in "javascript:void(1)"
[edit]: I added the P.S.