«« Cacti «« [ Main ] [ En Francais ] »» Zion National Park »»

March 03, 2004

javascript anti-spam

Neat way to write your email address on your homepage without having the spambots scanning it. Instead of writing the standard mailto:youremailaddress, have javascript split the string so that it is not recognizable unless you run the script. Javascript runs on the client side so your browser will be able to rebuild the string because it has a javascript interpretor which spambots don't have (yet)...

Instead of:

<a href="mailto:johndoe@hotmail.com">johndoe@hotmail.com</a>

Write something like:

<script TYPE="text/javascript">
<!--
emailE=('jo' + 'hn' + 'do' + 'e@' + 'hot' + 'mail' + '.com')
document.write('<a href="mailto:' + emailE + '">' + emailE + '</a>')
//-->
</script>

Neat isn't it? Saw it on TechTV.


Posted by sebatl at March 3, 2004 10:07 PM