Well, not really. In the Grand Scheme, it rates barely a hiccough — especially to seasoned programmers. Still, I experimented a little the other night and stretched my technical skills and vocabulary.
The premise is that I refuse to post email addresses in plain text to websites I manage. It’s just too easy to program a robot that sequentially looks at every page of every IP address for “name at domain dot top_level_domain” using the @ and dot (.) characters for reference. I’ve seen the result of unethical and sometimes unlawful use of email addresses harvested by the spiders of spammers.
So with the help of Chris Hill at IABC’S international headquarters in San Francisco (http://www.iabc.com/), I started using a script routine to embed the email address in JavaScript, where the spiders can’t find it. It literally doesn’t exist until the browser (client) executes the script on your computer. I use this script for every occurence on my own website (http://www.heavenr.com/) and every other website within my control.
The script is quite simple. It creates two variables (a_mail_name and a_mail_domain) into which you place the portions of a legitimate email address on either side of the @ sign. Then it uses document.write() statements to parse together the variables and the rest of a standard mailto: link. I’ve created them with CC variables, BCC variables, subject variables, and body text variables. I suppose I could also break the heavenr.com portion into two separate variables but I never saw a need. At its most basic, it looks like this:
<script language=”Javascript”>
a_mail_name = “heavener”
a_mail_domain = “heavenr.com”
document.write(”<a href=’mailto:” + a_mail_name + “@” + a_mail_domain + “‘>”);
document.write(”<span class=’H6′>”);
document.write(a_mail_name + “@” + a_mail_domain);
document.write(”</span>”);
document.write(”</a>”);
</script>
(Note that this blog’s software forces me to use the character replacements & l t ; and & g t ; in place of the less-than and greater-than symbols (left and right angle brackets) when I’m in edit mode. The strange thing is that when this article is in view mode, the replacements get converted back the way the script uses them — I guess YMMV applies here. If you copy the script, be sure to use the proper angle bracket characters.) You can also open up pages (view source) at my websites and copy the script.
A while back, I was redoing the website for my church ( BTW, for some reason it was changed to a web hosting company that undid all the hard-learned lessons about nonprofit web sites). I added a page for a new fundraising program (scrip.htm), so our congregation’s members can download the order forms anytime. For variety, I took a screen shot of one slide from the PowerPoint presentation and dropped it into the web page as a graphic. That slide has an email address, so I thought I should create an image map hotspot so the congregation could send messages, as the presentation intended.
But I stumped myself — image hotspots have a structured syntax that’s bigger than just an anchor tag. How in the world could I justify making the hotspot a readily harvestable plain text email address? It violated my sense of ethics and mocked the standard I’ve set for myself. The hotspot code defied my JavaScript. And there were no tips or comments out there on the worldwide web.
The only answer, obviously, was to roll up my sleeves and figure out how to modify the image map and/or the script so they work together. After some nosing around in the code, I finally found the ticket — embed the map’s anchor/coordinates statement inside the document.write() statements, like this:
<img src=”scrip.jpg” mce_src=”scrip.jpg” width=”326″ height=”244″ alt=”" border=”0″ hspace=15 usemap=”#scrip”>
<map name=”scrip”><map name=”scrip”>
<script language=”Javascript”>
a_mail_name = “heavener”
a_mail_domain = “heavenr.com”
document.write(”<area alt=’Email questions to us’ + “);
document.write(” coords=’37,146,201,166′ + “);
document.write(”href=’mailto:” + a_mail_name + “@” + a_mail_domain + “‘>”);
</script>
</map>
It wasn’t all that hard, really, but it made me feel happy that I could do it alone … without help. Justice lives on and the email address is only harvestable if a human touches the link. Take that, accursed spambots!
Tags: Internet, Technology