[thelist] Email address hiding question

David Bailey dab.hand at xtra.co.nz
Fri Jul 1 08:04:55 CDT 2005


Robert:

> Sorry about that, when I cut and pasted the script I missed the closing '}'.
> Here is the whole thing as a web page...

Works well. I should have checked for that missing brace, but I
automatically thought it was something more that I was missing!

Works fine in Safari too.

Thanks for your help.


Thanks to all who have contributed. I've got to know quite a bit about the
issues now and the variety of options available (and some pretty good
scripts that provide some kind of a solution to the problem of spam
harvesters. I can see it is an issue that has exercised developers for a few
years now and still remains something that people are coming up with new
ways of handling (thanks for the link to your Blog on your suggestion and
discussion, Chris). I appreciate, too, your patience with a novice in this
area, and on something that has obviously arisen before. I enjoy this list
for this reason, even though I'm really a silent member, but learning lots.

Regards,
David 


> From: "Robert Vreeland" <vreeland at studioframework.com>

> Sorry about that, when I cut and pasted the script I missed the closing '}'.
> Here is the whole thing as a web page
> The code tags should be remove. They are justs there for this email.
> <code>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <title>Email Address Hiding</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> <script language="JavaScript">
> <!--
> function changeMyColor(){
> linkArray = "";
> if(arguments[0].nodeName == ("A" || "a"))
> {
> linkArray = "mailto:";
> linkArray = linkArray + arguments[0].firstChild.innerHTML;
> linkArray = linkArray + "@";
> linkArray = linkArray +
> arguments[0].firstChild.nextSibling.nextSibling.innerHTML;
> arguments[0].href = linkArray;
> }
> 
> }
> 
> -->
> </script>
> </head>
> 
> 
> <body>
> 
> <a  href="#"
> onclick="changeMyColor(this)"><span>info</span>&#064;<span>adomain.com</span
>> </a>
> 
> </body>
> </html>
> </code>
> ----- Original Message -----
> From: "David Bailey" <dab.hand at xtra.co.nz>
> To: <thelist at lists.evolt.org>
> Sent: Friday, July 01, 2005 5:01 AM
> Subject: Re: [thelist] Email address hiding question
> 
> 
>> Hi Robert,
>> 
>> Thanks for the suggestion. It looks like a good option. I've tried it out,
>> but I think I'm missing something (perhaps I just don't know enough about
>> JavaScript to work out what to do!). I can't get it to open an email
> window.
>> 
>> I've put it all in one page while I test it:
>> http://www.dab-hand.co.nz/testbay/email/emailtest.html
>> 
>> Have I done this right?
>> 
>> Regards,
>> David
>> 
>>> From: "Robert Vreeland" <vreeland at studioframework.com>
>>> Reply-To: "thelist at lists.evolt.org" <thelist at lists.evolt.org>
>>> Date: Thu, 30 Jun 2005 23:38:29 -0400
>>> To: <thelist at lists.evolt.org>
>>> Subject: Re: [thelist] Email address hiding question
>>> 
>>> David,
>>> I don't if this will help, but I'm including the method I use. I prefer
> it
>>> over other anti-email harvesting spiders for two reasons. One, it
> doesn't
>>> use mailto in the href of the anchor tag just a '# ' so it appears as a
>>> named anchor tag to the spiders and uninteresting. Two, it still allows
> a
>>> user with javascript disabled to at least view the email address. So
> here it
>>> is:
>>> 
>>> Setup your email link like so:
>>> <a  href="#"
>>> 
> onclick="changeMyColor(this)"><span>info</span>&#064;<span>someplace.com</sp
>>> an></a>
>>> The span tags make it unlikely to be parsed by a spider as an email
> address
>>> through a regular expression, but won't effect the visual display so
>>> individuals can still get the email address to manually use.
>>> 
>>> I would recommend the onclick function being included in an external
>>> javascript file, but either way use a misleading function name.
>>> Here is the function I've successfully used in a couple of sites.
>>> 
>>> function changeMyColor(){
>>> linkArray = "";
>>> if(arguments[0].nodeName == ("A" || "a")){
>>> linkArray = "mailto:";
>>> linkArray = linkArray + arguments[0].firstChild.innerHTML;
>>> linkArray = linkArray + "@";
>>> linkArray = linkArray +
>>> arguments[0].firstChild.nextSibling.nextSibling.innerHTML;
>>> arguments[0].href = linkArray;
>>> 
>>> }
>>> Basicly it extracts the pertinent info and rebuilds the link as a mailto
>>> link when clicked by a user with a javascript enabled browser, otherwise
> the
>>> link does nothing.
>>> 
>>> I have tested the script in IE and Firefox, not sure how it works in
> safari
>>> though.
>>> Good luck
>>> Robert
>>> 
>>> ----- Original Message -----
>>> From: "David Bailey" <d.bailey at dab-hand.co.nz>
>>> To: <thelist at lists.evolt.org>
>>> Sent: Thursday, June 30, 2005 8:55 PM
>>> Subject: [thelist] Email address hiding question
>>> 
>>> 
>>>> Hi,
>>>> 
>>>> I am having trouble with a JS script designed to hide email addresses
> on a
>>>> web site. It was supplied in a newsletter and I can't get hold of the
>>>> developer of the script.
>>>> 
>>>> It appeals to me in that it is supposed to work if Javascript is turned
>>> off
>>>> in the user's browser.
>>>> 
>>>> What the script is meant to do:
>>>> ======================================
>>>> The URL has been 'decorated' with some spam blocking parts, and a hint
>>>> appears in the message body ('Please remove spam blocker'). If a user
> has
>>>> JavaScript enabled, the onClick() event handler takes control, which
>>>> exchanges the spam-blocking part with an at-sign. Additionally, the
> hint
>>> is
>>>> removed because it is no longer needed.
>>>> 
>>>> The Problem:
>>>> ============
>>>> It works correctly in a non-JS-enabled browser, but in a JS enabled web
>>>> browser the following problems occur:
>>>> 1. When the link is clicked it opens two email windows!
>>>> 2. The first window opens as it should with the "no-spam" text stripped
>>> from
>>>> the email address, but contains the 'Please remove spam blocker'
> message
>>> in
>>>> the Body.
>>>> 3. The second window (which opens over the top of the correct window)
>>>> contains the 'no-spam' text in the email address (and "correctly"
> contains
>>>> the Subject message).
>>>> 4. The process seems to open another browser window
>>>> 
>>>> I don't know enough about js to work out what is wrong. Can anyone help
>>>> here?
>>>> 
>>>> I reproduce the script below, but it can also be found as a working
>>> example
>>>> at:
>>>> http://www.dab-hand.co.nz/testbay/email/emailtest.html
>>>> (The script works the top link called "Information"
>>>> 
>>>> The script goes:
>>>> ================
>>>> 
>>>> In the head of the page:
>>>> 
>>>> function sendmail() {
>>>> // cancel std event processing
>>>> event.returnValue = false;
>>>> // remove spam blocker
>>>> var url = event.srcElement.href.replace(".no-spam at please.", "@");
>>>> url = url.replace("Please remove spam blocker. ", "");
>>>> // open email window
>>>> window.open(url);
>>>> }
>>>> 
>>>> In the body:
>>>> 
>>>> <p>
>>>> <a href="mailto:info.no-spam at please.adomain.com
>>>> ?subject=Put you subject header here.
>>>> &body=Please remove spam blocker. Place your message here. Thank you!"
>>>> onClick="sendmail()">Information</a>
>>>> </p>
>>>> 
>>>> 
>>>> Thanks for any help anyone can give me!
>>>> 
>>>> David
>>>> 
>>>> -- 



More information about the thelist mailing list