Advocacy

  Myths
  Press

Dojo (HowTo)

  General
  Hack
  Hardware
  Interface
  Software

Reference

  Standards
  People
  Forensics

Markets

  Web

Museum

  CodeNames
  Easter Eggs
  History
  Innovation
  Sightings

News

  Opinion

Other

  Martial Arts
  ITIL
  Thought


How to hide you email from Spam Spiders
Using Javascript


From NetBITS#015/22-Jan-98
Copyright 1998 TidBITS Electronic Publishing. All rights reserved.
For back issues, searching, and info: <http://www.netbits.net/>
To subscribe to our weekly list, email <netbits-on@netbits.net>

JavaScript Yourself Anonymous -- In response to letters on hiding your email address on a Web page to avoid spammers sucking it down, Joseph McLean <flux@thecentre.com> 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 <flux@thecentre.com> - 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).


Non-profit, non-commercial publications may reprint articles if full credit is given. Others please contact us. We don't guarantee accuracy of articles. Publication, product, and company names may be registered trademarks. NetBITS ISSN 1096-4908. To subscribe to NetBITS, send email to <netbits-on@netbits.net>. Visit the NetBITS Web site at <http://www.netbits.net/>.


Created: 07/30/98
Updated: 11/09/02


Top of page

Top of Section

Home