How to protect from spam bots your email published on web site
Posted by Stanislav Furman on February 16, 2012There are exist different ways how to protect your email address against email harvesting by spam bots. However, none of those methods can not give you 100% protection!
In this post I will show you one of those methods. This method I have used by myself and it works well as I can see.
First of all, at the place where you want to display your email address put this code:
<a href="#" id="contact"><span id="address"></span></a>
As you can see, it's just an empty anchor tag. The idea is to use Java Script and JQuery for displaying your email on a web page, rather than simple displaying of plain text. First of all, we will split your email by parts using the following Java Script:
var str1 = 'youremail';
var str2 = 'yourdomain';
var str3 = '@';
var str4 = '.';
var str5 = 'com';
var str0 = 'mailto:';
Then use the following JQuery code that will replace your empty <a> tag with an email built from separated parts:
$(document).ready(function() {
$('#contact').attr('href', str0 + str1 + str3 + str2 + str4 + str5);
$('#address').text(str1 + str3 + str2 + str4 + str5);
});
Comments
function gtr(name, domain)
{
if (domain == '')
domain = name_of_s + String.fromCharCode(46) + dom_ain;
mmm = String.fromCharCod(109) + String.fromCharCode(97) + "i" + String.fromCharCode(108) + String.fromCharCode(116) + String.fromCharCode(111) + String.fromCharCode(58) + name +
String.fromCharCode(64) + domain;
document.location.href = mmm;
}
In html:
<a href="JavaScript:gtr('myemail','yahoo.com')">myemail<img alt="[dog]" src="dog.gif"/>yahoo.com</a>
I hope it's a sarcastic note? It's currently hosted on GoDaddy's servers. Never tie up with them! Worse hosting ever. This website will move to a dedicated host soon.
Leave your comment