- JQuery Tutorials – Use JQuery to protect/rewrite emails from spam bots
- jQuery Tutorials – Hide/protect mailto: links from spam bots and email harvesters #2
- jQuery Tutorials – Hide/protect mailto: links from spam bots and email harvesters #3
Here is a jQuery snippet that can protect email addresses from email harvesters.
All you need to do is to inlcude .mail class to your “mailto:” html links like the example below.
1 |
<a href="mailto:peter_[at]_example.com" class="mail"> peter_[at]_example.com </a> |
1 2 3 4 5 6 |
$(document).ready(function(){ mailto = $("a[href^='mailto:']").attr('href'); $("a[href^='mailto:']").attr('href',mailto.replace(/_\[\at\]\_/gi,"@")); email = $('.mail').html(); $('.mail').html(email.replace(/_\[\at\]\_/gi,"@")); }); |
Geeks are sexy… :D