Email encode

back to resources

This script will allow you to hide your email address from bots that are scraping the html for links using the "mailto" attribute.

Example

Email me

If you view the source of this page, you can see that the example don't contain "mailto:" nor the at sign.

Normally you would create an email link as such

<a href="mailto:name@domain.com">Email me</a>

Using the lt.emailencode jQuery plugin, you can easily change this to something less accessible for a bot.

Html

<a href="name*domain.com">Email me</a>

Javascript

$(document).ready(function() {
    $(".mailto").emailencode();
});

The @ sign can be replaced with any character. Just specify the character as a parameter. In the following example we have specified the & sign to be the substitute for the at sign

$(document).ready(function() {
    $(".mailto").emailencode("&");
});

Download

download