Posted By

thefricky on 12/23/10


Tagged

email link jquery antispam


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

maltem
virendrakryadav
Balamir


Anti Spam email link


 / Published in: jQuery
 

Instead of writing the link in the HTML, just write the email address inside any tag you want (p, spam, div...) with the class "email", and put "[at]" instead "@". This script replace the "[at]" and create the link outside the spam robot sight

  1. $.each($('.email'), function(){
  2. var mail = $(this).text();
  3. mail = mail.replace('[at]','@');
  4. $(this).html('<a href="mailto:' + mail + '>' + mail + '</a>');
  5. });

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: verostudios on December 30, 2010

I'm not sure if this would work, pretty sure bots just use some sort of pattern matching on the entire page code looking for any email addresses listed.

Posted By: thefricky on February 2, 2011

Good point. In any case you can change "[at]" for any text you want and then replace it with the script.

You need to login to post a comment.