How Can I get external links to come up in a new window

Discussion in 'HTML & Website Design' started by timothy104, Jul 21, 2006.

  1. #1
    How Can I get external links to come up in a new window

    thanks in advance
     
    timothy104, Jul 21, 2006 IP
  2. vagrant

    vagrant Peon

    Messages:
    2,284
    Likes Received:
    181
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <a href="external.html" target="_blank">external link</a>
     
    vagrant, Jul 21, 2006 IP
  3. minstrel

    minstrel Illustrious Member

    Messages:
    15,082
    Likes Received:
    1,243
    Best Answers:
    0
    Trophy Points:
    480
    #3
    Like this:

    <a href="http://www.somesite.com/somepage.html" target="_blank">anchor text</a>
    Code (markup):
     
    minstrel, Jul 21, 2006 IP
  4. timothy104

    timothy104 Guest

    Messages:
    633
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #4
    that was fast, fixed the problem, thanks
     
    timothy104, Jul 21, 2006 IP
  5. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #5
    The target attribute is not valid in any strict DTD. You must use a loose or transitional DTD, and then only to point to a frame.

    To be valid in this case, you should use a javascript event handler. A strictly valid method with robust failover is this:
    
    <a href="some.html"
       onclick="return !window.open(this.href);">some page</a>
    Code (markup):
    Should the javascript open the new window, the html link will not fire. If the javascript fails to open the window or the javascript is not active, the normal html link fires.

    cheers,

    gary
     
    kk5st, Jul 21, 2006 IP
  6. msmp3

    msmp3 Peon

    Messages:
    297
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    @kk5st, this is good to know information. thanks for sharing with us ;)
     
    msmp3, Jul 22, 2006 IP
  7. minstrel

    minstrel Illustrious Member

    Messages:
    15,082
    Likes Received:
    1,243
    Best Answers:
    0
    Trophy Points:
    480
    #7
    Oh pffftttt!

    It's valid HTML and it works.
     
    minstrel, Jul 22, 2006 IP
  8. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #8
    It may work, as a lot of improperly coded stuff does. It is not, however, valid html, as used. The conditions I stated are correct. There is no sane reason to use invalid markup when valid markup is just as easy to learn and use.

    If you wish to use invalid markup, that's your business, but it strikes me as doing a disservice to the community to knowingly spread bad information. If you don't know html, now's an opportunity for edification.

    cheers,

    gary
     
    kk5st, Jul 22, 2006 IP
  9. minstrel

    minstrel Illustrious Member

    Messages:
    15,082
    Likes Received:
    1,243
    Best Answers:
    0
    Trophy Points:
    480
    #9
    Gee, that's not arrogant or snotty or condescending at all, is it? :rolleyes:

    There's nothing wrong with the information I'm "spreading" and I really do not need any "edification" from the likes of you. I'm not going to get into the W3C debate again - you are also free to do what you want but lose the condescension - I don't need it and neither does anyone else here.
     
    minstrel, Jul 22, 2006 IP
  10. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #10
    Actually, no. I gave a simple abstract of the governing body's recommendations. (And don't start some silly debate over whether a recommendation is a standard. It is a standard in that all the major players from browser vendors to the companies that depend on http—a standard itself called an RFC, Request for Comments—handed off the formulation to the W3C and agreed to accept their recommendations as a, wait for it, standard.) It was you that responded with a Bronx cheer and an arrogantly erroneous statement. You think it's not erroneous? Show me your sources and I'll show you mine. Or, are you right "just because"? Oh! Did you confuse your post with mine? It would seem so.

    "I really do not need any "edification" from the likes of you." Ah, there's the condescending part, and arrogant and pretty snotty, too.

    I am reminded of the old saw, "it's not what you don't know, but what you do know that just isn't so that causes problems". Minstrel, I don't know in which field your expertise lies. From this thread and others, it is patently obvious that it is not in html. You, sirrah, are the personification of my present signature line.

    If you find this post to be arrogant and snotty, I will not disagree. It is not condescending, as I will not stoop to accommodate myself to your inferior knowledge of html.

    gary
     
    kk5st, Jul 22, 2006 IP