[thelist] Email address hiding question

Robert Vreeland vreeland at studioframework.com
Fri Jul 1 07:22:56 CDT 2005


Matt,
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
> >>
> >> -- 
> >>
> >> * * Please support the community that supports you.  * *
> >> http://evolt.org/help_support_evolt/
> >>
> >> For unsubscribe and other options, including the Tip Harvester
> >> and archives of thelist go to: http://lists.evolt.org
> >> Workers of the Web, evolt !
> >
> > -- 
> >
> > * * Please support the community that supports you.  * *
> > http://evolt.org/help_support_evolt/
> >
> > For unsubscribe and other options, including the Tip Harvester
> > and archives of thelist go to: http://lists.evolt.org
> > Workers of the Web, evolt !
>
> -- 
>
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !



More information about the thelist mailing list