JavaScript Yourself Anonymous
JavaScript Yourself Anonymous — In response to letters on hiding your email address on a Web page to avoid spammers sucking it down, Joseph McLean <[email protected]> wrote us with a nifty JavaScript-based solution, which he offers for free:
Brandon Munday mentioned how he removed all "clickable" mailto links from his Web site to thwart the evil address-collecting spiders. Making a site non-clickable is so counter to the Web’s nature that I became convinced there had to be another way. And there is – if you turn to JavaScript for aid.
JavaScript is not ubiquitous technology, but this can also work in your favor, because spiders don’t speak that language – and most of your human visitors have browsers that do. Here’s an example I cooked up in five minutes.
<script language=javascript>
<!–
// SpamProof Mail Script 1.0
// by Joseph McLean <[email protected]> – freeware
// Linktext is the text you want folks to see and click upon.
// email1 & email2 are the text on either side of your
// email address’s @ sign.
var linktext = "Email Me!"
var email1 = "jsmith"
var email2 = "where-ever.com"
document.write("<a href=" + "mail" + "to:" + email1 + "@" + email2 + ">" + linktext + "</a>")
//–>
</script>
This chunk of code can be pasted into your Web page’s HTML at any point. Some old browsers don’t support JavaScript, but they won’t hit an error – the mail link will simply be invisible (as it is to spiders).