Need to add this code to my website to hide my email from spam bots

Discussion in 'Javascript' started by fb3003@gmail.com, Jun 24, 2006.

  1. Guest

    how can i add this code:

    <script language=javascript>
    <!--
    var username = "fb3003";
    var hostname = "gmail.com";
    var linktext = "Click Here To Send Me Email";
    document.write("<a href=" + "mail" + "to:" + username +
    "@" + hostname + ">" + linktext + "</a>")
    //-->
    </script>

    to replace in this line:


    <td width="100%" bgcolor="#FFFFFF"><font face="Arial"><small><p
    align="right"></small></font><a href="index.htm"
    onMouseOver="imgAct('img5')" onMouseOut="imgInact('img5')"><img
    name="img5" src="home.gif" alt="Click for - Home" border="0" width="31"
    height="30"></a><a onMouseOver="imgAct('img6')"
    onMouseOut="imgInact('img6')" href="mailto:"><img
    name="img6" src="mail.gif" alt="Click to - Send us an Email" border="0"
    width="40" height="30"></a><a href="http://www.yahoo.com"
    onMouseOver="imgAct('img7')" onMouseOut="imgInact('img7')"><img
    name="img7" src="search.gif" alt="Click to - Perform an Internet
    Search" border="0" width="31" height="30"></a></td>

    basically, I have an envelope picture and when the mouse goes over it,
    it change color and you can click on it, and send an email. I am
    getting tons of spam, so I got the javascript code from this website
    http://www.virtuallyignorant.com/fightspam.htm , hoping that I can
    use a version of it, so that I can still use the envelope and mouse
    over option.

    Any help is greatly appreciated.
    Thanks
     
    , Jun 24, 2006
    #1
    1. Advertising

  2. Danny Guest

    Instead of using ol' document.write(), try ->
    <script type="text/javascript">
    <!--
    function STUFF() {
    var username = "fb3003";
    var hostname = "gmail.com";
    var linktext = "Click Here To Send Me Email";
    return "\m\a\i\l" + "\t\o:" + username +"@" + hostname +
    ">"+linktext;
    }
    //-->
    </script>


    <a .... href="javascript:STUFF()">
     
    Danny, Jun 24, 2006
    #2
    1. Advertising

  3. Randy Webb Guest

    Re: Need to add this code to my website to hide my email from spambots

    Danny said the following on 6/24/2006 12:05 AM:
    > Instead of using ol' document.write(), try ->


    And then do what is typically recommended of code from Danny, ditch it
    and forget you ever saw the garbage as that is what that code was.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Temporarily at: http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
     
    Randy Webb, Jun 24, 2006
    #3
  4. Re: Need to add this code to my website to hide my email from spambots

    Danny <> writes:

    > Instead of using ol' document.write(), try ->
    > <script type="text/javascript">
    > <!--
    > function STUFF() {
    > var username = "fb3003";
    > var hostname = "gmail.com";
    > var linktext = "Click Here To Send Me Email";
    > return "\m\a\i\l" + "\t\o:" + username +"@" + hostname +
    > ">"+linktext;
    > }
    > //-->
    > </script>
    > <a .... href="javascript:STUFF()">


    This fails, badly.
    The javascript:-href will not magically turn into a mailto:-url
    when it's executed. Instead the page will be replaced by the return
    value of the STUFF function, i.e., "mail o:...>Click Here...".
    (yes,"\t" is the tab character).

    /L
    --
    Lasse Reichstein Nielsen -
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
    'Faith without judgement merely degrades the spirit divine.'
     
    Lasse Reichstein Nielsen, Jun 24, 2006
    #4
  5. jojo Guest

    Re: Need to add this code to my website to hide my email from spambots

    schrieb:
    > how can i add this code:
    >
    > <script language=javascript>
    > <!--
    > var username = "fb3003";
    > var hostname = "gmail.com";
    > var linktext = "Click Here To Send Me Email";
    > document.write("<a href=" + "mail" + "to:" + username +
    > "@" + hostname + ">" + linktext + "</a>")
    > //-->
    > </script>
    >
    > to replace in this line:
    >
    >
    > <td width="100%" bgcolor="#FFFFFF"><font face="Arial"><small><p
    > align="right"></small></font><a href="index.htm"
    > onMouseOver="imgAct('img5')" onMouseOut="imgInact('img5')"><img
    > name="img5" src="home.gif" alt="Click for - Home" border="0" width="31"
    > height="30"></a><a onMouseOver="imgAct('img6')"
    > onMouseOut="imgInact('img6')" href="mailto:"><img
    > name="img6" src="mail.gif" alt="Click to - Send us an Email" border="0"
    > width="40" height="30"></a><a href="http://www.yahoo.com"
    > onMouseOver="imgAct('img7')" onMouseOut="imgInact('img7')"><img
    > name="img7" src="search.gif" alt="Click to - Perform an Internet
    > Search" border="0" width="31" height="30"></a></td>
    >
    > basically, I have an envelope picture and when the mouse goes over it,
    > it change color and you can click on it, and send an email. I am
    > getting tons of spam, so I got the javascript code from this website
    > http://www.virtuallyignorant.com/fightspam.htm , hoping that I can
    > use a version of it, so that I can still use the envelope and mouse
    > over option.
    >
    > Any help is greatly appreciated.
    > Thanks
    >


    You can leave out the JavaScript and crypt your E-Mail...

    http://www.oraab.de/php4/crypt.php4
     
    jojo, Jun 27, 2006
    #5
  6. Jeremy Guest

    Re: Need to add this code to my website to hide my email from spambots

    wrote:
    > Any help is greatly appreciated.
    > Thanks
    >


    First, if you're already getting lots of spam, it's too late for you.
    You're on their lists. Removing the e-mail address now is not going to
    get you off the lists.

    Second, doing this with javascript is a pretty bad idea. You might try
    replacing some or all of the characters in the <mailto:> url with their
    URL-encoded escape codes - i.e. replacing @ with %40. Not sure if this
    will faze the bots, but it's worth a try.

    In any case, javascript is probably not the answer, and document.write
    *certainly* is not.

    Jeremy
     
    Jeremy, Jun 27, 2006
    #6
  7. Philip wrote:
    <snip>
    > I've been testing this with some spamtrap email addresses,
    > and it appears to work quite well (but not perfectly).

    <snip>

    So it doesn't occur to you that the software used by spammers will
    evolve to be the most effective for the task? As soon as you admit that
    what you are doing is not perfect you are admitting that their exist
    e-mail address gathering techniques that are significantly superior to
    those currently in common use. Give it time and those techniques will be
    the ones in common use so all you may be doing by taking an approach
    that 'mostly works' at present is guaranteeing yourself future
    maintenance work to mitigate for the changing nature of the e-mail
    address extracting software.

    Richard.
     
    Richard Cornford, Jun 29, 2006
    #7
  8. Philip wrote:
    > Richard Cornford wrote:


    >> Philip wrote:
    >> <snip>
    >>> I've been testing this with some spamtrap email addresses,
    >>> and it appears to work quite well (but not perfectly).

    >><snip>
    >>
    >> So it doesn't occur to you that the software used by spammers will
    >> evolve to be the most effective for the task? ...

    <snip>

    > I disagree. I think spammers are after the low-hanging
    > fruit that is unobfuscated email addresses, and there
    > doesn't seem to be a shortage of that now or in the
    > foreseeable future.


    You don't see this thread as being an indication in itself that your
    'low-hanging fruit' is already trying to move out of reach?

    > You're right that spam harvesting programs could
    > conceivably evolve to handle obfuscated addresses,
    > but I see very little pressure for them to do so.


    They already exist, they just are not yet in common use. Your own
    qualification of "but not perfectly" suggests that some are already
    defeating your e-mail address obfuscation. So the 'evolution' does not
    have to be in the software for the task, just in the choice of software
    that people use for the task.

    > If you disagree, that's your opinion and I'm not going
    > to try to tell you it's wrong. But one thing is for sure:
    > right now, obfuscating one's email address will foil more
    > email harvesters than not obfuscating.


    What I am saying is that what may be true "right now" may not be true
    next year. So if you can address the problems you may have next year
    with the same effort now as you are spending on implementing a technique
    that can be defeated it makes more sense to do that now.

    > I believe (and am trying to assemble real data to so I
    > can rely on something besides intuition here) that using a
    > Javascript-based method is more secure than simple
    > obfuscation, even allowing for evolution of email
    > harvesting programs. I think it is unlikely that email
    > harvesters will ever develop the ability to interpret
    > Javascript,


    The e-mail harvesters that are based upon automating the Microsoft web
    browser COM object (Internet Explorer) can already interpret and execute
    javascript (well, technically JScript).

    > not because it is too difficult to do but because it would
    > be resource-intensive, a little dangerous, and would
    > have a very low ROI.

    <snip>

    It has already been done, would not take more than a week's work to do
    again, and once written could be employed by thousands of individuals
    (if made available). That is not too much investment, so the return is
    proportional to the number of people trying to use javascript to obscure
    their e-mail addresses.

    Richard.
     
    Richard Cornford, Jun 30, 2006
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    8
    Views:
    485
    Philip
    Jun 30, 2006
  2. Rene Pijlman
    Replies:
    22
    Views:
    753
    Fredrik Lundh
    Dec 10, 2003
  3. Replies:
    6
    Views:
    508
  4. patrick j
    Replies:
    38
    Views:
    1,411
    John Hosking
    Mar 11, 2007
  5. Klaus Caprani

    Banning the spam-bots

    Klaus Caprani, Jul 6, 2003, in forum: Javascript
    Replies:
    1
    Views:
    83
    Evertjan.
    Jul 6, 2003
Loading...

Share This Page