Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New Coder
    Join Date
    Jun 2003
    Location
    UK
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    hyperlink to java script

    I have been using java scripts to give email addresses on my website so that the email-collecting spiders can't see them.

    I have a problem (I am a novice). I have a java script on my website at /java/online_email.js which reads:

    <!--
    var username = "dawson";
    var hostname = "the-limes.com";
    document.write("<a href=" + "mail" + "to:" + username +
    "@" + hostname + ">" + "</a>")
    //-->

    On a test page I have an image which hyperlinks to "mailto:dawson@the-limes.com" using the html code:

    <a href= "mailto:dawson@the-limes.com"><img border=0 src="http://opi.yahoo.com/online?u=simongoodhughdawson&m=g&t=2"></a>

    QUESTION: How do I change the html code above to run the java script /java/online_email.js instead of the mailto:?

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Posts
    698
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <script src="java/online_email.js"><script><img border=0 src="http://opi.yahoo.com/online?u=simongoodhughdawson&m=g&t=2"></a>



    NOTE: remove the </a> tag in the javascript

  • #3
    New Coder
    Join Date
    Jun 2003
    Location
    UK
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks

    Thanks for the help. It worked (once I had added an extra / before the second 'script'!).

    Simon

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Unfortunately there's an accessibility problem there - because it's written in javascript, not everyone can see it.

    My view is that you have to live with webmaster spam, by writing good rules and maybe having server-filters as well; live with it because, if you want to be universally contactable then you do have to expose your email address in literal plain text.
    Last edited by brothercake; 06-14-2003 at 08:40 AM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #5
    Regular Coder
    Join Date
    Sep 2002
    Location
    self.location
    Posts
    181
    Thanks
    0
    Thanked 0 Times in 0 Posts
    brothercake, I can't vouch for this, but I have heard that bots will fail to "pick up" a mailto: link if it's written out with entities. So if we obfuscate the key characters the bot is looking for, like mailto: and @ and any dots... like so:


    <a href="&amp;#109;&amp;#97;&amp;#105;&amp;#108;&amp;#116;&amp;#111;&amp;#58;webmaster&amp;#64;mydomain &amp;#46;com">
    webmaster&amp;#64;mydomain&amp;#46;com&nbsp;</a>


    The link text will be translated into normal literal text when viewed inside all browsers, and the mailto: URL will be successfully translated by the e-mail client into a usable e-mail address, but I don't know if it actually prevents bots from grabbing the e-mail address.

    ***

    Anyone have some experience with this technique? Or can vouch for it?

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    or oyu could but your email addy in a picture like a jpeg or gif.

    Or take after a guy in california who but i statement along with his unique email addy. It basically stated he would read any unsolicated email and recieve $500 and the company could be sueable.

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #7
    Regular Coder
    Join Date
    Sep 2002
    Location
    self.location
    Posts
    181
    Thanks
    0
    Thanked 0 Times in 0 Posts
    or oyu could but your email addy in a picture like a jpeg or gif.
    Yeah, but that has implications for accessibility as well (people who don't have images turned on don't see the addy).

    And also you would have to wrap the image in a link, and then you still face the original quandary regarding how to specify the mailto: without letting the bots pick it up.

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you wouldn't have to wrap it in a link, as the whole point is any legitimate people will read it and type it into there email client.

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #9
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yes but for surfers who don't have images ... you'd still need to put the real mail addy in the ALT attribute ..
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #10
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    realisis, my understanding is that trick doesn't work, because most address harvesters rely on standard http and html libraries, and are capable of properly rendering character entities. don't hold me to that, though.
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #11
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    but you see in the alt text you could have it in words as in @ would be at. Or you use a series of letter images in the alt text just put that letter in it, and place them in a row.

    hmm that sounds looney.

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •