Open links in new window

Discussion in 'HTML & Website Design' started by geniosity, Jan 17, 2006.

  1. #1
    Hi,

    Sorry for the lame question, but, how do I get a link to open in a new window? Does it have to be in JavaScript? I reallly hope not.

    Thanks...
     
    geniosity, Jan 17, 2006 IP
  2. ing

    ing Well-Known Member

    Messages:
    500
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    195
    #2
    Here's some sample HTML you can use to get a link to open in a new window...

    <a href="http://www.sitename.com/page.html" target="_blank">Link Text</a>
    Code (markup):
    :)
     
    ing, Jan 17, 2006 IP
  3. geniosity

    geniosity Peon

    Messages:
    293
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks, I'll try it.
     
    geniosity, Jan 17, 2006 IP
  4. mdvaldosta

    mdvaldosta Peon

    Messages:
    4,079
    Likes Received:
    362
    Best Answers:
    0
    Trophy Points:
    0
    #4
    yea what he said, just use target="_blank"
     
    mdvaldosta, Jan 17, 2006 IP
  5. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I have always used target="_new" :)
     
    exam, Jan 17, 2006 IP
  6. my44

    my44 Peon

    Messages:
    722
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #6
    There's also an option to control the size of the new window. For example if you want to display a train schedule or a photograph in a smaller window. I think you need a JavaScript for that. It depends for what purpose.
     
    my44, Jan 18, 2006 IP
  7. geniosity

    geniosity Peon

    Messages:
    293
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #7
    thanks. It's just so that people don't have to leave my site if I give them a link that's not an ad. Sounds greedy, but I'd like a user to finish reading a page, not getting distracted by the promise of better info elsewhere...

    I'll try them and see. Maybe it will downgrade the absolute beauty of my site... ;)
     
    geniosity, Jan 18, 2006 IP
  8. tonyrocks

    tonyrocks Active Member

    Messages:
    1,574
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    88
    #8
    target="_tonyrocks" should work as well. Watch for pop-up blockers though.
     
    tonyrocks, Jan 19, 2006 IP
  9. lorien1973

    lorien1973 Notable Member

    Messages:
    12,206
    Likes Received:
    601
    Best Answers:
    0
    Trophy Points:
    260
    #9
    target="_ilikeboobies" is my favorite :p

    I think if you use target, popup blockers won't catch it, as the window required interaction to open up.
     
    lorien1973, Jan 19, 2006 IP
  10. tonyrocks

    tonyrocks Active Member

    Messages:
    1,574
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    88
    #10
    hehe...nice target Lorien! hehe.
     
    tonyrocks, Jan 19, 2006 IP
  11. geniosity

    geniosity Peon

    Messages:
    293
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #11
    i'll try the boobies one i think... will AdSense count this as porn? :D
     
    geniosity, Jan 19, 2006 IP
  12. tonyrocks

    tonyrocks Active Member

    Messages:
    1,574
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    88
    #12
    You'l probably get those darned PSA ads :) hehe
     
    tonyrocks, Jan 19, 2006 IP
  13. missdanni

    missdanni Guest

    Best Answers:
    0
    #13
    If you wanted more control over the new window you could use js. However you may get caught in popup blockers.

    <!-- STEP ONE: Copy this code into the HEAD of your HTML document  -->
    
    <HEAD>
    
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    function Start(page) {
    OpenWin = this.open(page, "CtrlWindow", "toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes");
    }
    // End -->
    </SCRIPT>
    
    </HEAD>
    
    <!-- STEP ONE: Paste this code into the BODY of your HTML document  -->
    
    <BODY>
    
    <center>
    <form>
    <input type=button onClick="Start('http://forums.digitalpoint.com')" value="Open DigitalPoint.com">
    </form>
    or<P>
    <a href="javascript:Start('http://forums.digitalpoint.com')";>Open DigitalPoint Forums</a>
    </center>
    Code (markup):
     
    missdanni, Jan 23, 2006 IP