Protect your email addresses from spam
Convert the email address to Unicode characters
This was not a bad idea in the past, but also bots evolve It can just as easily interpret the special character entities #64;, #46; for the @ and the . characters respectively. A minor plus in this case is that, the user may be able to use their email client.
HTTP redirection
Write a server-side script to return "mailto:foo@host.com" link as an HTTP redirect. All modern browsers recognise this, but perhaps not many harvester bots do. This can be done with Apache’s mod_rewrite, Javascript or server-side scripting. Here is an example in PHP:
/* Will be displayed in browser like*/
/* In email_foo.php file */
<?php
header ("Location: mailto:foo@host.com");
exit();
?>
In this case the user has to follow the link and rely on their mail application to get a hold of the email address. The user has to copy the email address from the application instead of doing it directly from the webpage.
Using a JavaScript (my favorite)
/* Will be displayed in browser like*/
—- script —
<script language="JavaScript" type="text/javascript">
function email(n, d) {
if(d == 1){
document.location.href=’mailto:’ + n + ‘@gmail.com?Subject=contacting from webpage’;
}
if(d == 2){
document.location.href=’mailto:’ + n + ‘@hotmail.com?Subject=contacting from webpage’;
}
if(d == 3){
document.location.href=’mailto:’ + n + ‘@someotherdomain.com?Subject=contacting from webpage’;
}
if(d == 4){
document.location.href=’mailto:’ + n + ‘@christiano.ch?Subject=contacting from webpage’;
}
}
</script>
— end of script—
however, there are several good methods, it’s almost impossible to list them all .. if you’re interested in protecting your email address using other ways, here are a few keywords to use when searching in Goggle or Bing..
Hex values
HTML Comments
Fake email
Obfuscate AJAX
CSS pseudo-element
Images
CSS unicode-bidi
CSS display be none
Flash
Forms