Josh Dick portrait Josh Dick

Elegant E-Mail Address Obfuscation

User-friendly e-mail links that outsmart spam bots.

I recently redesigned my personal web site, http://joshdick.net. During the redesign process, I came up with what I consider to be an elegant way to present an e-mail address as a clickable “mailto:” link on a web page, without exposing the e-mail address to spam bots. My method doesn’t rely on HMTL character entities or JavaScript string concatenation, and includes a graceful fallback for JavaScript-free environments.

The code is available as a GitHub gist. The comments in the code explain the technique.