Navigation
Popular content
Active forum topics
|
Web authors: defend against email address harvestersThis article is for web authors. It would even apply to postings on a Content Management System like this, but for security reasons it is not allowed to enter Javascript code here. Never put real email addresses in web sites. The reason is that web email address harvesters will find them and use them to send spam to the address. Here are two Javascript-based ways to obfuscate email addresses such that they remain clickable. Method 1: Use a character other than @ Example using the copyright © character: Code to achieve this: <a href="mailto:name©domain.com" onclick="var obfuscated = this.getAttribute('href'); if (obfuscated.indexOf('©') > 0) { this.href = obfuscated.split('©')[0] + '@' + obfuscated.split('©')[1]; }">name©domain.com</a> Method 2: Insert an uncommon obfuscation string Example using xxxremovexxx. Don't use RemoveThis or DeleteThis or upper case markers, as these may be recognized by address harvesters: Code to achieve this: <a href="mailto:namexxxremovexxx@domain.com" onclick="var obfuscated = this.getAttribute('href'); var obfuscatorString = 'xxxremovexxx'; if (obfuscated.indexOf(obfuscatorString) > 0) { this.href = obfuscated.split(obfuscatorString)[0] + obfuscated.split(obfuscatorString)[1]; }">email</a> Notes:
Method 3: Use an even stronger obfuscator You can enter an email addres on this projecthoneypot.org page to have it obfuscated in an even more complex way, also using Javascript. Technical background: When the user clicks on the link, Javascript is activated through the onclick attribute. The little Javascript program takes the href attribute and removes or replaces the obfuscation. The important point is that the final, correct email address doesn't appear anywhere in the original page, not even in the Javascript code, because otherwise it could be found through email address harvesting. |
User login
Donations If this web site has helped you, please help us too! Recent blog posts
Windows news ticker
Who's new
Who's online
There are currently 0 users and 8 guests online.
hits since 2010-03-12 · Statistics |
1 hour 33 min ago
1 day 22 hours ago
3 days 3 hours ago
1 week 18 hours ago
1 week 5 days ago
1 week 5 days ago
1 week 6 days ago
1 week 6 days ago
1 week 6 days ago
1 week 6 days ago