Hide email address with image as link

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • HornyLaBelle

    Hide email address with image as link

    I'm hiding the email address on a website with this javascript which
    works fine:
    ---------------------------------
    <p>Send your comments and questions to our

    <script language=javasc ript>

    <!--

    var contact = "Newsletter Editor"

    var email = "news"

    var emailHost = "netmechanic.co m"

    document.write( "<a href=" + "mail" + "to:" + email + "@" + emailHost+
    ">" + contact + "</a>" + ".")

    //-->

    </script>

    </p>
    ---------------------------------
    How can I make an image instead of the text as a link to start this
    script?

    Thanks in advance

  • Randy Webb

    #2
    Re: Hide email address with image as link

    HornyLaBelle said the following on 3/9/2006 6:42 AM:[color=blue]
    > I'm hiding the email address on a website with this javascript which
    > works fine:[/color]

    No, you just think it works fine.
    [color=blue]
    > ---------------------------------
    > <p>Send your comments and questions to our
    >
    > <script language=javasc ript>[/color]

    <script type="text/javascript">
    [color=blue]
    > <!--[/color]

    Drop the ill conceived notion of hiding scripts.
    [color=blue]
    > var contact = "Newsletter Editor"
    >
    > var email = "news"
    >
    > var emailHost = "netmechanic.co m"
    >
    > document.write( "<a href=" + "mail" + "to:" + email + "@" + emailHost+
    > ">" + contact + "</a>" + ".")
    >
    > //-->[/color]

    Drop the hiding scripts, it isn't needed anymore and can actually do
    harm in some circumstances.
    [color=blue]
    > </script>
    >
    > </p>
    > ---------------------------------
    > How can I make an image instead of the text as a link to start this
    > script?[/color]

    Instead of the variable contact, you would write out an img tag.

    --
    Randy
    comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: Hide email address with image as link

      HornyLaBelle wrote:
      [color=blue]
      > I'm hiding the email address on a website with this javascript[/color]

      Utter nonsense.
      [color=blue]
      > which works fine:[/color]

      No, it does not.


      PointedEars

      Comment

      • Gernot Frisch

        #4
        Re: Hide email address with image as link

        [color=blue]
        > <p>Send your comments and questions to our
        > <script language=javasc ript>
        > <!--
        > var contact = '<img src="gfx/some_image.png" alt="email me">'
        > var email = "news"
        > var emailHost = "netmechanic.co m"
        > document.write( "<a href=" + "mail" + "to:" + email + "@" +
        > emailHost+
        > ">" + contact + "</a>" + ".")
        > //-->
        > </script>
        > </p>[/color]




        Comment

        • Gernot Frisch

          #5
          Re: Hide email address with image as link

          [color=blue][color=green]
          >> //-->[/color]
          >
          > Drop the hiding scripts, it isn't needed anymore and can actually do
          > harm in some circumstances.[/color]

          Why? What's the problem?


          Comment

          • HornyLaBelle

            #6
            Re: Hide email address with image as link

            > > How can I make an image instead of the text as a link to start this[color=blue][color=green]
            > > script?[/color]
            >
            > Instead of the variable contact, you would write out an img tag.[/color]

            I tried this but it doesn't work. Can you please give an example? I
            don't know a lot about javascript...

            Comment

            • RobG

              #7
              Re: Hide email address with image as link

              Gernot Frisch wrote:[color=blue][color=green][color=darkred]
              >>> //-->[/color]
              >>
              >>Drop the hiding scripts, it isn't needed anymore and can actually do
              >>harm in some circumstances.[/color]
              >
              >
              > Why? What's the problem?[/color]

              The main problem is that some script authors think they can use HTML style
              comments anywhere in the script, then can't work out why it won't run.

              The tags also get carried over to .js files where their potential effects
              can be masked further. The content of script elements should be passed
              as-is to the script engine. It seems that modern browsers either remove
              the tags before passing the content to the script engine, or the engine
              itself deals with them. Provided the opening tag comes before any real
              script they don't cause a problem, but that can't be relied upon /ad
              infinitum/.

              Note that comments should never have been required for script elements
              inside the head, which is where most of them are.

              Another potential hazard is if the tags are used with XHTML - but again
              some browsers seem to 'fix' that.



              --
              Rob

              Comment

              • Gernot Frisch

                #8
                Re: Hide email address with image as link


                "HornyLaBel le" <sapion@gmx.d e> schrieb im Newsbeitrag
                news:1141916146 .715791.272370@ u72g2000cwu.goo glegroups.com.. .[color=blue][color=green][color=darkred]
                >> > How can I make an image instead of the text as a link to start
                >> > this
                >> > script?[/color]
                >>
                >> Instead of the variable contact, you would write out an img tag.[/color]
                >
                > I tried this but it doesn't work. Can you please give an example? I
                > don't know a lot about javascript...[/color]

                See my other reply - it's all there


                Comment

                • Manifest Interactive

                  #9
                  Re: Hide email address with image as link

                  Greetings,

                  First I must apologize for users like PointedEars who somehow think
                  they are making a contribution by bad mouthing people who need help. It
                  seems every post they make does nothing to further anyone's
                  knowledge.

                  Here is how you would fix your code to use an image:

                  <script language=javasc ript>
                  var contact = "Newsletter Editor";
                  var email = "news";
                  var emailHost = "netmechanic.co m";
                  document.write( "<a href='mailto:"+ email+"@"+email Host+"'><img
                  src='http://groups.google.c om/groups/img/groups_medium.g if' width='150'
                  height='58' border='0'>"+co ntact+"</a>");
                  </script>

                  Also, if interested I have written a free JavaScript utility I use for
                  all my clients that encrypts email links for you. You can even pass it
                  a CSS class to use While the method you are using works for basic
                  protection, malicious harvesting robots can still read your source code
                  and piece things together. Especially when you use keywords like
                  "email".

                  Senior full-stack engineer, technical lead, and AI developer building scalable products, ecommerce systems, and practical AI workflows.


                  Hope this helps,
                  Peter Schmalfeldt

                  HornyLaBelle wrote:[color=blue]
                  > I'm hiding the email address on a website with this javascript which
                  > works fine:
                  > ---------------------------------
                  > <p>Send your comments and questions to our
                  >
                  > <script language=javasc ript>
                  >
                  > <!--
                  >
                  > var contact = "Newsletter Editor"
                  >
                  > var email = "news"
                  >
                  > var emailHost = "netmechanic.co m"
                  >
                  > document.write( "<a href=" + "mail" + "to:" + email + "@" + emailHost+
                  > ">" + contact + "</a>" + ".")
                  >
                  > //-->
                  >
                  > </script>
                  >
                  > </p>
                  > ---------------------------------
                  > How can I make an image instead of the text as a link to start this
                  > script?
                  >
                  > Thanks in advance[/color]

                  Comment

                  • Thomas 'PointedEars' Lahn

                    #10
                    Re: Hide email address with image as link

                    Manifest Interactive wrote:
                    [color=blue]
                    > First I must apologize for users like PointedEars who somehow think
                    > they are making a contribution by bad mouthing people who need help.
                    > It seems every post they make does nothing to further anyone's
                    > knowledge.[/color]

                    At least I /know/ what I am talking about.

                    You are not helping the OP by posting this "solution", you are hurting
                    him/her in the mid-term. Because e-mail communication will be impossible
                    for many, if not most, of his/her users while you give the false impression
                    that this would be a viable approach that serves at least many users.
                    There is a word for that: incompetence.
                    [color=blue]
                    > Here is how you would fix your code to use an image:
                    >
                    > <script language=javasc ript>[/color]
                    ^^^^^^^^^^^^^^^ ^^^^^[color=blue]
                    > var contact = "Newsletter Editor";
                    > var email = "news";
                    > var emailHost = "netmechanic.co m";
                    > document.write( "<a href='mailto:"+ email+"@"+email Host+"'><img
                    > src='http://groups.google.c om/groups/img/groups_medium.g if' width='150'
                    > height='58' border='0'>"+co ntact+"</a>");[/color]
                    ^^^^
                    The markup is not Valid, and therefore not supposed to be interoperable.

                    1. The `language' attribute is deprecated long since (December 1999),
                    the `type' attribute is required. The language attribute is not
                    Valid in HTML 4.01 Strict, XHTML 1.0 Strict, and XHTML 1.1.

                    2. mailto: is known to be highly unreliable (IOW: known not to work).

                    3. Writing the link with client-side scripting and so introducing a
                    dependency on that technique makes it even worse.

                    4. The `img' element requires the `alt' attribute, as text alternative
                    if the image cannot be displayed.

                    5. ETAGO delimiters </ must be escaped within CDATA element content, or
                    the element is considered to end prematurely by the markup parser,
                    causing a syntax error for the script engine here.

                    So there are the following possibilities:

                    1. There is no client-side script support, the script is filtered by a
                    proxy, or the client works strictly standard compliant:

                    The user sees exactly nothing, and depending on the strictness of
                    the parser, if there is client-side script support, and the script
                    is not filtered, the user gets a nice error message, too.

                    2. There is client-side script support, the script is not filtered,
                    and despite the markup being not Valid the script is executed, but

                    a) the user is blind or visually impaired, and therefore can not find
                    the link (there is no text that can be interpreted by a Braille line
                    or read to him aloud by a screenreader);
                    b) there is no e-mail client installed;
                    c) the HTML user agent (UA) does not support mailto: URIs;
                    d) the e-mail client is not configured with the UA to handle mailto: URIs

                    Where each of b) to d) is highly likely with users having a Web mail
                    account.

                    For the infinitesimal tiny rest of users, this nonsense actually works.
                    Big time.
                    [color=blue]
                    > [unsolicited advertising]
                    > [top post][/color]

                    FOAD!


                    PointedEars

                    Comment

                    • Thomas 'PointedEars' Lahn

                      #11
                      Re: Hide email address with image as link

                      Thomas 'PointedEars' Lahn wrote:
                      [color=blue]
                      > 1. There is no client-side script support, the script is filtered by a
                      > proxy, [...][/color]

                      .... or by a "desktop firewall", or it is rendered not working by that
                      (such as with Norton InSecurity). And probably I forgot something more.


                      PointedEars

                      Comment

                      • Manifest Interactive

                        #12
                        Re: Hide email address with image as link

                        The "PointedEar s" must be your horns. Oh, and by the way, here is a
                        word you obviously need the definition to, must be the ONLY thing you
                        don't know, right?

                        ------------------------------------------------------

                        ad·ver·tise
                        v. ad·ver·tised, ad·ver·tis·ing, ad·ver·tis·es
                        v. tr.

                        To make public announcement of, especially to proclaim the qualities or
                        advantages of (a product or business) so as to increase sales.

                        ------------------------------------------------------

                        Me providing a link to a free tool I wrote that has no marketing on it
                        that can help people better secure their email links is a NICE and
                        POLITE thing that I do to HELP people. It is certainly not
                        "unsolicite d advertising". They can even take it and use it
                        themselves if they want. I don't care. (I capitalized the "big
                        words" you might not understand).

                        Well, I am off to help other people, I am sure I will see a response
                        following this outlining many ways that nothing I submit will work.,
                        just like you do on everyone else's messages. Sure hope you don't
                        talk to people in person the way you do on here.

                        Here's a challenge for you. Write one nice response to a user, come
                        back here and post the link so I can see that you actually helped
                        someone out. My bet is that I will never see anything.

                        Later pessimist

                        PS, your site http://www.pointedears.de/ needs a lot of work bro.

                        - Peter Schmalfeldt

                        Thomas 'PointedEars' Lahn wrote:[color=blue]
                        > Manifest Interactive wrote:
                        >[color=green]
                        > > First I must apologize for users like PointedEars who somehow think
                        > > they are making a contribution by bad mouthing people who need help.
                        > > It seems every post they make does nothing to further anyone's
                        > > knowledge.[/color]
                        >
                        > At least I /know/ what I am talking about.
                        >
                        > You are not helping the OP by posting this "solution", you are hurting
                        > him/her in the mid-term. Because e-mail communication will be impossible
                        > for many, if not most, of his/her users while you give the false impression
                        > that this would be a viable approach that serves at least many users.
                        > There is a word for that: incompetence.
                        >[color=green]
                        > > Here is how you would fix your code to use an image:
                        > >
                        > > <script language=javasc ript>[/color]
                        > ^^^^^^^^^^^^^^^ ^^^^^[color=green]
                        > > var contact = "Newsletter Editor";
                        > > var email = "news";
                        > > var emailHost = "netmechanic.co m";
                        > > document.write( "<a href='mailto:"+ email+"@"+email Host+"'><img
                        > > src='http://groups.google.c om/groups/img/groups_medium.g if' width='150'
                        > > height='58' border='0'>"+co ntact+"</a>");[/color]
                        > ^^^^
                        > The markup is not Valid, and therefore not supposed to be interoperable.
                        >
                        > 1. The `language' attribute is deprecated long since (December 1999),
                        > the `type' attribute is required. The language attribute is not
                        > Valid in HTML 4.01 Strict, XHTML 1.0 Strict, and XHTML 1.1.
                        >
                        > 2. mailto: is known to be highly unreliable (IOW: known not to work).
                        >
                        > 3. Writing the link with client-side scripting and so introducing a
                        > dependency on that technique makes it even worse.
                        >
                        > 4. The `img' element requires the `alt' attribute, as text alternative
                        > if the image cannot be displayed.
                        >
                        > 5. ETAGO delimiters </ must be escaped within CDATA element content, or
                        > the element is considered to end prematurely by the markup parser,
                        > causing a syntax error for the script engine here.
                        >
                        > So there are the following possibilities:
                        >
                        > 1. There is no client-side script support, the script is filtered by a
                        > proxy, or the client works strictly standard compliant:
                        >
                        > The user sees exactly nothing, and depending on the strictness of
                        > the parser, if there is client-side script support, and the script
                        > is not filtered, the user gets a nice error message, too.
                        >
                        > 2. There is client-side script support, the script is not filtered,
                        > and despite the markup being not Valid the script is executed, but
                        >
                        > a) the user is blind or visually impaired, and therefore can not find
                        > the link (there is no text that can be interpreted by a Braille line
                        > or read to him aloud by a screenreader);
                        > b) there is no e-mail client installed;
                        > c) the HTML user agent (UA) does not support mailto: URIs;
                        > d) the e-mail client is not configured with the UA to handle mailto: URIs
                        >
                        > Where each of b) to d) is highly likely with users having a Web mail
                        > account.
                        >
                        > For the infinitesimal tiny rest of users, this nonsense actually works.
                        > Big time.
                        >[color=green]
                        > > [unsolicited advertising]
                        > > [top post][/color]
                        >
                        > FOAD!
                        >
                        >
                        > PointedEars[/color]

                        Comment

                        • HornyLaBelle

                          #13
                          Re: Hide email address with image as link


                          Manifest Interactive schrieb:
                          [color=blue]
                          > Here is how you would fix your code to use an image:
                          >
                          > <script language=javasc ript>
                          > var contact = "Newsletter Editor";
                          > var email = "news";
                          > var emailHost = "netmechanic.co m";
                          > document.write( "<a href='mailto:"+ email+"@"+email Host+"'><img
                          > src='http://groups.google.c om/groups/img/groups_medium.g if' width='150'
                          > height='58' border='0'>"+co ntact+"</a>");
                          > </script>[/color]

                          Manifest Interactive, thanks a lot, but when I copy this script into my
                          html the image is not displayed. It only works with a text link. I
                          tried it several different ways, really strange...

                          Comment

                          • Manifest Interactive

                            #14
                            Re: Hide email address with image as link

                            Greetings,

                            Are you copying this script inside your body tag? Also, make sure that
                            you removed all the line breaks that this forum will put in the code.
                            In all total there should only be 6 lines of code including the <script
                            language=javasc ript> and </script> tags. If you have more than that,
                            then that is the problem.

                            Here is a link to a sample page I put up on my site for you:

                            Senior full-stack engineer, technical lead, and AI developer building scalable products, ecommerce systems, and practical AI workflows.


                            Just copy that code if you want. Hope this solves your problem.

                            - Peter Schmalfeldt

                            HornyLaBelle wrote:[color=blue]
                            > Manifest Interactive schrieb:
                            >[color=green]
                            > > Here is how you would fix your code to use an image:
                            > >
                            > > <script language=javasc ript>
                            > > var contact = "Newsletter Editor";
                            > > var email = "news";
                            > > var emailHost = "netmechanic.co m";
                            > > document.write( "<a href='mailto:"+ email+"@"+email Host+"'><img
                            > > src='http://groups.google.c om/groups/img/groups_medium.g if' width='150'
                            > > height='58' border='0'>"+co ntact+"</a>");
                            > > </script>[/color]
                            >
                            > Manifest Interactive, thanks a lot, but when I copy this script into my
                            > html the image is not displayed. It only works with a text link. I
                            > tried it several different ways, really strange...[/color]

                            Comment

                            • Thomas 'PointedEars' Lahn

                              #15
                              Re: Hide email address with image as link

                              HornyLaBelle wrote:
                              [color=blue]
                              > Manifest Interactive schrieb:[color=green]
                              >> Here is how you would fix your code to use an image:
                              >> [Invalid code][/color]
                              >
                              > Manifest Interactive, thanks a lot, but when I copy this script into
                              > my html the image is not displayed. It only works with a text link.
                              > I tried it several different ways, really strange...[/color]

                              Blind leading the blind ... It would be funny if it would not be so sad.

                              FWIW, you are looking for a (server-side) form mailer, such as
                              <URL:http://formmailer.com/ (or write your own in any server-side language;
                              I prefer PHP), not mailto: or client-side scripting, and certainly not the
                              nonsense provided by the incompetent spammer posing here. This way, your
                              e-mail address is known only server-side, not to the users (or a potential
                              spammer). And _all_ of them will be able to send you e-mail anyway. By
                              using POST requests and server-side sessions, you can successfully prevent
                              most attempts spamming to the resource the form points to.


                              HTH & HAND

                              PointedEars

                              Comment

                              Working...