Now blogging at diego's weblog. See you over there!

hiding mailto: addresses with javascript

Making it harder for crawlers to discover email addresses is something that is not hard to do, but it's one of those things that I at least keep redoing just because it's so easy to do. But it should be instantaneous! :) So here's some code, which I've written in different forms over the years, neatly packaged.

What the code does is run a simple substitution cypher on the address, then shows all the code you'd need to include on a page to make it work (using simple CSS/DHTML tricks, making a layer visible). It also lets you include text to put on the links, so that a single Javascript call put anywhere on the page generates the full mailto: link.

By changing the ordering of letters in the key variable, you can change the way it encrypts things for your page. Okay, "encryption" maybe a bit of an overstatement here, but technically... :)

Just for clarity, here's the link again. It's all under an MIT License, so you're free to do with it as you will. Hope this is useful!

Posted by diego on January 4 2005 at 12:57 PM

Copyright © Diego Doval 2002-2011.
Powered by
Movable Type 4.37