Computing.Net > Forums > Web Development > Hide e-mail address

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Hide e-mail address

Reply to Message Icon

Name: JEY
Date: February 19, 2005 at 12:59:51 Pacific
OS: Windows XP
CPU/Ram: 512 MB
Comment:

Some time back I remember seeing a method of hiding an e-mail address used as a link from crawlers. Presently we have the address in simple text form, but the ideal would to be have it as a link.

Does anyone know of a way?

chejose



Sponsored Link
Ads by Google

Response Number 1
Name: jam14online
Date: February 19, 2005 at 13:28:47 Pacific
Reply:

Here is the simple email text:

someone@domain.com

Here is the HTML hyperlink source:

< a href="mailto:someone@domain.com" > someone@domain.com < /a >

Either way, most spam crawlers can get the email address from both methods. All they usually do is search for the '@' sign and get the text either side.

Using Javascript is one employed method of hiding email addresses. However, it means people with Javascript disabled (many people do disable it) won't be able to email you. Another method would be to use an email form, which sends through a CGI/PHP/ASP/etc script. However, most people prefer to compose emails in their email client so I wouldn't recommend this method. (Or provide both a contact form and an email address.)

There are also some methods of CSS to hide your email address from spam bots/harvesters. Here's one example:

Cutting Edge CSS | Hiding Email Address

However, people on older browsers, text browsers or screen readers (makes up quite a significant percentage) most likely won't be able to access it.

Simple solution: just put a normal mailto: hyperlink, open for the spam harvesters to get but then employ strong filtering on your email server or email client. Probably the best spam filter I've used to date is the one built-in to Mozilla Thunderbird. If you use it for a month or so, you "teach" it how to sort spam and it really is quite intelligent.

I hope this helps,


James



0

Response Number 2
Name: Dr. Nick
Date: February 19, 2005 at 13:37:36 Pacific
Reply:

You do know that it doesn't matter if it's in a mailto link or not, right? Plain text is picked up just as easily (if not easier) than an email address in a link.

You can use this Javascript function I wrote a while ago to obfusicate email addresses. Just put it in the HEAD of each document you want to use it, then where you want the email address printed, type <script>mail2('TLD', 'domain', 'user');</script>

function mail2(three, two, one)
{
   document.write('<a href="mailto:' + 
   one + '@' + two + '.' + three + '">' + 
   one + '@' + two + '.' + three + '</a>');
}

You may need to modify the code a bit if you want to make the A element a specific class, etc.

That should prevent any crawlers that don't actually render the webpage from getting your address. However, the only way to be REAL safe is to use images which is a big pain.



0

Response Number 3
Name: Dr. Nick
Date: February 19, 2005 at 13:41:41 Pacific
Reply:

That page you linked to is pretty sweet James. I'm going to have to remember that one.


0

Response Number 4
Name: JEY
Date: February 19, 2005 at 16:43:11 Pacific
Reply:

Very good. There are a couple of things to try. Actually probably the simplest is to use a graphic instead of text. As was mentioned, not all have java disabled.

Many thanks for the suggestions and for clarifying the matter.

JEY

chejose


0

Response Number 5
Name: SN
Date: February 19, 2005 at 18:42:26 Pacific
Reply:

Another tip of the hat to the backwards method James linked to...Very clever.

Using a graphic instead of text is fine...As long as you don't make it a mailto: link, since the e-mail address will still be picked up by the crawler.

Personally, I don't care about the 'mailto' link functionality, so I usually just put some invisible html in the address:
myaddress< b>< /b>@< b>< /b>hotmail.com.

-SN

-SN


0

Related Posts

See More



Response Number 6
Name: jam14online
Date: February 20, 2005 at 11:49:22 Pacific
Reply:

That page is pretty neat, huh? CSS tricks are my favourite to find out about. ;-)

@SN

What happens if the email harvester strips out HTML before grabbing the email address? Then it just sees it as plain text.

I still think leaving it as a normal mailto: link is best (no funny, potentially incompatible tricks). And then an intelligent spam filter.



0

Response Number 7
Name: fambi
Date: February 20, 2005 at 14:14:53 Pacific
Reply:

My personal recommendation is to translate your address into HTML partially or in full. Browsers will still be able to interpret the code, but harvesting scripts will not. In this case, your email address will be clickable. For the ASCII code table, please see <http://www.ascii.cl>: andreeac@domain#46;com


If you're interested in SMS, visit my wife's site .


0

Response Number 8
Name: Dr. Nick
Date: February 20, 2005 at 15:02:51 Pacific
Reply:

Doh. Fambi - your post reminded me that I'd actually updated that javascript function I posted above. When I went looking for it earlier, I grabbed the old one.

The syntax is the same, but the function is different. This is what I was using:
==========================================================

<script>

function convert(text)
{
    var newText = "";

    for (i=0; i<text.length; i++)
        newText += "&#" + text.charCodeAt(i) + ";";

    return newText;
}

function mail2(three, two, one)
{
   one = convert(one);
   two = convert(two);
   three = convert(three);
   var mailto = convert('mailto:');

   document.write('<a href="' + mailto + 
   one + '@' + two + '.' + three + '">' + 
   one + '@' + two + '.' + three + '</a>');
}
</script>

Then just use it the same as before, typing:

<SCRIPT>mail2('TLD', 'domain', 'user');</SCRIPT>

This seemed to work pretty well for us. Since we started using this style, new email addresses haven't been picked up by spammers as fast as they used to be.


0

Response Number 9
Name: SullyD
Date: February 26, 2005 at 02:24:56 Pacific
Reply:

Take a look at http://mailtoprotector.com/

SullyD


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: Hide e-mail address

PHP e-mail form: Option element www.computing.net/answers/webdevel/php-email-form-option-element/3147.html

E-mail submition form - forgotten! www.computing.net/answers/webdevel/email-submition-form-forgotten/653.html

Creating A Mailing List www.computing.net/answers/webdevel/creating-a-mailing-list/2027.html