How to hide your email address from a web crawler

Instead of including your email address as plain text in a web page, use a little JavaScript that constructs your email address when a browser loads that page. This prevents web crawlers or spambots from detecting your email address in a public web page. If you publish web pages with your email address, this is one of best ways to avoid being added to spam mailing lists.

In the following sample, cut and paste it into your web page, then substitute the appropriate replacements for First-name, Last-name, username, and host.com.

<script language=javascript>
  var fullName = "First-name Last-name"
  var user = "username"
  var domain = "host.com"
  var address = user + "@" + domain
  var linkStart = "<a href=" + "mail" + "to:" + address + ">"
  var linkEnd = "</a>"
  var linkName = linkStart + fullName + linkEnd
  var linkAddress = linkStart + address + linkEnd
  document.write(linkName + " " + "<" + linkAddress + ">")
</script>
The above JavaScript displays the following in a browser as: