Here's a quick little jQuery script I created just now. Don't give your email address to spam bots! Instead, try this.
Markup:
ColdFISH is developed by Jason Delmore. Source code and license information available at coldfish.riaforge.org
<a href="/contact"><span class="no-script">Contact Us</span><span class="obfuscate">com/mydomain//me</span></a>
1<a href="/contact"><span class="no-script">Contact Us</span><span class="obfuscate">com/mydomain//me</span></a>
(Use your email address in the format above, where your original address is me@mydomain.com)
CSS:
ColdFISH is developed by Jason Delmore. Source code and license information available at coldfish.riaforge.org
span.obfuscate{
display: none;
}
1span.obfuscate{
2 display: none;
3}
Javascript (jQuery):
ColdFISH is developed by Jason Delmore. Source code and license information available at coldfish.riaforge.org
// email obfuscator
var $obfuscate = function(el){
var obStr = $(el).text();
var prefix = obStr.split("//")[1];
var suffix = obStr.split("//")[0];
var domain = suffix.split("/")[1];
var ext = suffix.split("/")[0];
var returnStr = prefix + '@' + domain + '.' + ext;
// console.log(returnStr);
$(el).text(returnStr).show(100);
}
$('span.obfuscate').each(function(){
$(this).siblings('.no-script').hide();
$obfuscate(this);
});
1// email obfuscator
2var $obfuscate = function(el){
3 var obStr = $(el).text();
4 var prefix = obStr.split("//")[1];
5 var suffix = obStr.split("//")[0];
6 var domain = suffix.split("/")[1];
7 var ext = suffix.split("/")[0];
8 var returnStr = prefix + '@' + domain + '.' + ext;
9 // console.log(returnStr);
10 $(el).text(returnStr).show(100);
11
12}
13
14$('span.obfuscate').each(function(){
15 $(this).siblings('.no-script').hide();
16 $obfuscate(this);
17});
This example uses a link to the /contact/ page of a website, and does not open an email address. If you wanted to use a mailto link you could adapt the script slightly to also handle the 'href' value of the link's parent like so:
ColdFISH is developed by Jason Delmore. Source code and license information available at coldfish.riaforge.org
$(el).text(returnStr).show(100).parents('a').attr('href','mailto:' + returnStr);
1$(el).text(returnStr).show(100).parents('a').attr('href','mailto:' + returnStr);
I don't think bots will grab com/domain//me and add it to a junk mail list, but they'll certainly harvest an email in plain text, or in the href of a "mailto" link. The idea is that, since the bots don't view the text rendered via javascript, they don't see the actual address, just the obfuscated version, when crawling through the source code.
Posted November 5, 2013 at 8:53 PM | 5129 views
|
1
I didn't want to create extra linkbait. Here's a method I wrote that uses jQuery. I choose to use empty ahrefs w/special data parameters.
http://bit.ly/1be6nns
The format looks like this and nothing is displayed on the webpage if JS is not enabled:
[a href="" data-u="username" data-d="domain.com"][/a]
NOTE: I also wrote a ColdFusion UDF to auto-generate the mailto links and have used jSoup to convert existing email addresses within an HTML page fragment (CMS) to this format on-the-fly.