[Web4lib] Mailto: links that can't be harvested by spambots?

Tim Spalding tim at librarything.com
Sun Feb 18 07:58:54 EST 2007


Javascript obfuscation works very well. The chance that someone will
mention the library emails elsewhere—forum, a resume, etc.—is a
thousand times higher than the chance someone will write a bot that
defeats your JavaScript.

Here's a simple one that both writes the email and a mailto: link around it.

<script language="JavaScript" type="text/javascript">

function printemail(address, domain)
{
document.write("<p><a href='mailto:" + address + "@" + domain + "'>" +
address + "@" + domain + "</a></p>");
}

printemail('tim', 'librarything.com');
printemail('abigail', 'librarything.com');

</script>

There is a slight drawback to JS techniques—they're not fully
accessible. If the user has JS turned off, the links vanish. That's
rare, but, in the real world very many people don't have their system
configured to make mailto: links work. (Generally they use a web-based
ap, but the mailto still points to the default desktop ap.—probably
Outlook.) This isn't just grandma. I don't have mine set up either!
(Side note; This is also why you should never ever have a mailto: link
under innocuous text like "contact.")

In my opinion the best solution is to just show the email. Give the
user the work of putting it into their email program. They won't mind.

To show it safely, use a graphic in place of the at sign. Then give it
descriptive "alt" text for blind-accessibility like:

tim<img src="http://www.librarything.com/pics/squiggle.gif" alt="[at
sign]">librarything.com

Best,
Tim

On 2/18/07, David Rothman <david.rothman at gmail.com> wrote:
> Links below feature scripts (or tools which generate scripts) that are
> claimed to generate mailto: links for a page that is viewable to the user,
> but that cannot be harvested by spambots.
>
>
>    - http://www.willmaster.com/possibilities/demo/aelgwase.html
>    - http://www.joemaller.com/js-mailer.shtml
>    - http://med.stanford.edu/irt/web/clips/javascript-antispam.html
>    - http://www.seoconsultants.com/tools/email/
>    - http://mailtoprotector.com/
>
>
> Any opinions on whether or not this sort of solution is effective?
> _______________________________________________
> Web4lib mailing list
> Web4lib at webjunction.org
> http://lists.webjunction.org/web4lib/
>


More information about the Web4lib mailing list