View Single Post
  #1 (permalink)  
Old 18-01-2008, 12:10 PM
Lawrence Lawrence is offline
Forum Admin
 
Join Date: Aug 2007
Location: Kenley, Surrey, UK
Posts: 1,226
Thanks: 2
Thanked 82 Times in 82 Posts
Default How to display your email address on a page so the spam bots cannot read it.

One way to do it is to display it as an image, but this isn't very convenient for the user as they cannot click it to open their email client nor copy and paste it. One alternative is to use a link to an email form script, but this restricts what the user can do and also potentially opens a door for your server to be abused by an undesirable.

This method uses JavaScript to write the email address to the browser, which means that your address isn't in the source for the bots to read but is fully functional to your visitors.


HTML Code:
<script language="JavaScript"><!--
var name = "YOUR_NAME";
var domain = "YOUR_SITE.com";
document.write('<a href=\"mailto:' + name + '@' + domain + '\">');
document.write(name + '@' + domain + '</a>');
// --></script>
__________________
Lawrence
Reply With Quote