I developed a wordpress themes ages ago and had this script going in a script.js
file:
$(document).ready(function() {
$('.spampro').each(function() {
var email = $(this).find('.n').text() + "@" + $(this).find('.e1').text() + "." + $(this).find('.e2').text();
$(this).html("<a href=\"mailto:" + email + "\">" + email + "</a>");
});
});
});
});
Now years after when I wanted to use it again I cant recall how I used to get my mailto/email addresses protected. I have a small memory of when I wrote: myemail@adress.com
it was encoded in the page source.
I searched for the .spampro
without any success. Perhaps will any of you be familiar of how I used it since i'm not a code wizard.
That script appears to be looking for the following HTML structure, and replacing it with a link tag:
$('.spampro').each(function() { var email = $(this).find('.n').text() + "@" + $(this).find('.e1').text() + "." + $(this).find('.e2').text(); $(this).html("<a href=\\"mailto:" + email + "\\">" + email + "</a>"); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="spampro"> <span class="n">name</span> <span class="e1">example</span> <span class="e2">com</span> </div>
I very much doubt this technique would provide any protection at all from email harvesters these days -- all they'd need to do is allow your page to finish running the above script before scraping.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.