You want visitors to be able to click on email address directly on the webpage?

However, if should be a little bit harder for bots and other crawlers to get the email address and register it in a spam list.

There are different ways of doing this (i.e. encoding mailto HTML links), either with JavaScript or in pure HTML.

JavaScript remains one of the best mailto obfuscator.

For users with JavaScript disabled you may want to substitute the mailto link with a link to a contact form.


The following is a popular JavaScript anti spam email obfuscator:


// This code is freeware provided these four comment lines remain intact
// A wizard to generate this code is at http://www.jottings.com/obfuscator/
{ coded = "[email protected]"
  key = "0SLUxGlmeHItWyOn9aYKuDwiEJX4sd17VTPg28Frk3fhBcNCQAj6boRvqZpM5z"
  shift=coded.length
  link=""
  for (i=0; i<coded.length; i++) {
    if (key.indexOf(coded.charAt(i))==-1) {
      ltr = coded.charAt(i)
      link += (ltr)
    }
    else {    
      ltr = (key.indexOf(coded.charAt(i))-shift+key.length) % key.length
      link += (key.charAt(ltr))
    }
  }
document.write("<a href=mailto:"+link+">"+link+"</a>")
}
//-->
</script><noscript>Sorry, you need Javascript on to email me.</noscript>