Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Creating a mail hyperlink by Javascript

    I am having a Not Very Bright day...

    I have some HTML which reads
    <p style="margin-top:0;margin-bottom:0;">name_of_someone</p>
    and I want to tag it with a mail hyperlink in the form of some Javascript which encodes "mailto:name_of_someone@ourdomain.com"
    which I have had to make an attached text file because the Lounge is not happy with it 'in-line'...

    How do I do it, please?

    Thanks

    John
    Attached Files Attached Files
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  2. #2
    Plutonium Lounger
    Join Date
    Oct 2001
    Location
    Lexington, Kentucky, USA
    Posts
    12,107
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Creating a mail hyperlink by Javascript

    Maybe I'm not reading your question well, John, but isn't the answer in this thread of yours recently: <post:=617,865>post 617,865</post:> ?

  3. #3
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Creating a mail hyperlink by Javascript

    Sadly, no!

    I want to insert the results of that email cloaker into some pre-existing HTML but cannot determine the correct insertion-point, nor whether anything needs to be removed...

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  4. #4
    Plutonium Lounger
    Join Date
    Oct 2001
    Location
    Lexington, Kentucky, USA
    Posts
    12,107
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Creating a mail hyperlink by Javascript

    I used the link to the encoder that you provided, except that I took the "old" HTML email code from http://www.alhoffman.org/bigaldoc.html and placed the code in the ADVANCED section of the encoder page. Then all I had to do was put the resulting script into my HTML table (see page source). The "old" code to which I refer had a regular, plain text email link as well as the email graphic.

  5. #5
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Creating a mail hyperlink by Javascript

    John

    Writing the code out and reading it in a browser I see this

    document.write ('') document.write ('name_of_someone @ ourdomain.com')

    So it is writing to the page just I am not sure how the script ties in <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>
    Jerry

  6. #6
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Creating a mail hyperlink by Javascript

    Al:

    Afraid I don't understand. I assume that the Javascript code has to be inserted 'somewhere' in the original HTML file - but I can't determine where

    Jerry:

    Yes, that's what it's supposed to do - make it extremely difficult for the web address to be harvestable from the original web page but make it work exactly like you'd expect when the hyperlinked email address is clicked on when the user calls up the web page! I am trying to get the result <font color=blue>name_of_someone@ourdomain.com</font color=blue> but can't see where the Javascript has to be added/inserted in my original HTML fragment.

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  7. #7
    Plutonium Lounger
    Join Date
    Oct 2001
    Location
    Lexington, Kentucky, USA
    Posts
    12,107
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Creating a mail hyperlink by Javascript

    Check out this attached text file to see if it explains what I did on my referenced BigAl web page.

    As you can see, after you look at my file, I put the "encoded" stuff right between the <center> and </center> tags

    In other words, I had an un-encoded HTML snippet to start with and just put the encoded part right back from whence I took the snippet. I don't sound too elegant today, do I?
    Attached Files Attached Files

  8. #8
    Plutonium Lounger
    Join Date
    Oct 2001
    Location
    Lexington, Kentucky, USA
    Posts
    12,107
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Creating a mail hyperlink by Javascript

    And just in case you or anyone else wonders, the output from that particular encoder that you recommended in your earlier thread can have all its extraneous line feeds removed. See THIS attached text file.
    Attached Files Attached Files

  9. #9
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Creating a mail hyperlink by Javascript

    To take the matter forward.

    I have now put a hyperlink on the original name, and the resulting HTML becomes (leaving out the other stuff):

    <a href="mailto:name_of_someone@ourdomain.com>Name_of _Someone</a>

    Should I just be replacing this entire line segment with the entire Javascript code previously posted (from one or other of the email cloakers)?

    I said I wasn't having a very bright day...

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  10. #10
    Plutonium Lounger
    Join Date
    Oct 2001
    Location
    Lexington, Kentucky, USA
    Posts
    12,107
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Creating a mail hyperlink by Javascript

    John, when I open YOUR encoded text in my editor, it results in a preview that starts and ends as follows: (the large, bold text)

    <a href="<big>mailto:name_of_someone@ourdomain.com</big>>Name_of_Someone</a>

    So, that's where I'd put the encoded text, including the starting and ending script tags. But something doesn't look right in your post. I think you've not quoted the HTML exactly as it is. I think there's a quote symbol missing after the .com

  11. #11
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Creating a mail hyperlink by Javascript

    Yes, I was typing it by hand!

    Tomorrow I may get a chance to play with the whole thing at work.

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  12. #12
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Creating a mail hyperlink by Javascript

    >> Yes, I was typing it by hand!

    Er... what do you normally type with?

  13. #13
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Creating a mail hyperlink by Javascript

    I think the traditional way to do this is the use document.write in a <script> block in place. An alternative would be to enhance the document after loading, but you need a way to relate address data to text in the document. The easiest is to have a link without a functional email address, such as:

    Name_of_Person

    and have a script read through all the links in the document looking for those that match mailto: (exactly), then look up the correct address in an array by Name_of_Person and assign the href attribute to that address. There is an advantage of centralization: you could put the array all in one file and have it fix up any page. Of course, it also would be a mother lode of addresses for spammers who get their hands on that file (e.g., from their browser cache).

    Oh well... perhaps the old way is better suited for this sort of thing.

  14. #14
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Creating a mail hyperlink by Javascript

    The way things seem to be going at present, with my feet!

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  15. #15
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Creating a mail hyperlink by Javascript

    I have now had a proper chance to play with Dreamweaver, and find that with a bit of messing around I can just do what I said in my previous post, namely to replace

    Name_of_Someone

    with the generated Javascript code from one of the HTML email cloakers. I currently prefer the web-based EnkoderForm, and I actually prefer the way it generated fixed-length lines of code. I do stick a comment in front to say something like
    < !-- Joseph Bloggs -->
    (space required to get the comment to show!).

    However, I wonder whether all these email cloaking schemes would come to naught if the spam harvester could load each web-page on a website into a browser and look (in memory? in the browser cache?) for instances of text that looks like <someone>@<somedomain.com>. What's the likelihood of this, would anyone think?

    Thanks

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

Page 1 of 2 12 LastLast

Posting Permissions

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