Submit Your Article Forum Rules

Results 1 to 4 of 4

Thread: 'target=_blank' in XHTML

  1. #1
    Senior Member
    Join Date
    Jul 2003
    Posts
    1,331

    'target=_blank' in XHTML

    I know that there is a javascript that can overcome the loss of target=_blank in XHTML strict, however, I am pretty sure that it wont validate in XHTML strict. Yes I know I can slack it down to Transitional if I really want to use it, but...I thought I would first check out if anyone knew of another way to overcome opening a second window (for offsite links), yet still staying compliant with XHTML Strict.

    I have seen this discussed previously on WPW, but cant find where it was. I have looked at a few sites regarding it, but they all seem to point to the javascipt.

    So does anyone know of another way to achieve this?


    Cindy
    [url returns 404 - removed by mod 07/11]
    It' time for Progressive Web & IT Development!

  2. #2
    Senior Member paulhiles's Avatar
    Join Date
    Jul 2003
    Posts
    2,062
    I'm not sure there is a satisfactory answer to the question of links opening new windows in XHTML1.1 Strict. You're right though, it's come under discussion a few times at WPW.
    Here are a couple of links, one from Site Design, the other from the Accessibility forum.

    http://www.webproworld.com/viewtopic.php?p=43978#43978
    http://www.webproworld.com/viewtopic.php?p=28509#28509

    Both threads involved Narasinha... maybe he's come across the answer and keeping it to himself!? <j/k>

    Paul

  3. #3
    Senior Member
    Join Date
    Jul 2003
    Posts
    1,331
    Thanks Paul for going to that effort of finding them! I did a quick look but didnt have time to have a look too far. I knew I had seen them discussed somewhere.

    Well..thats a pain in the butt that you can't do it. I had my fingers crossed for this one anyway :-)


    Cindy
    [url returns 404 - removed by mod 07/11]
    It' time for Progressive Web & IT Development!

  4. #4
    WebProWorld MVP mikmik's Avatar
    Join Date
    Aug 2003
    Posts
    1,525
    <a rel="external" href ="Yallcomebacknowyahear.html" etc...
    http://factor1.net/assets/skripts/openlinkNew.js
    function externalLinks() {
    if (!document.getElementsByTagName) return;
    var anchors = document.getElementsByTagName("a");
    for (var i=0; i<anchors.length; i++) {
    var anchor = anchors[i];
    if (anchor.getAttribute("href") &&
    anchor.getAttribute("rel") == "external")
    anchor.target = "_blank";
    }
    }
    window.onload = externalLinks;
    That's all you need. As you can see, it validates 1.0 strict, and css no warniungs either.

    <div id="footer" class="alnc"><div class="linkl">[img]/assets/images/linkpic/factor1helplink.gif[/img]</div>
    <div class="linkl"><h1>DESIGNS with a PURPOSE</h1></div><div class="linkl">[img]/assets/images/linkpic/webdlink.gif[/img]</div>

    <div class="alnc xxsmall">main logo designed by: CINDY</div>

    </div>

    http://factor1.net/assets/skripts/css/master.css
    .linkl{display:inline; position:static(default);}

    AAA=longdesc="http://factor1.net/"
    Babies don't need a vacation, but I still see them at the beach... it pisses me off! I'll go over to a little baby and say 'What are you doing here? You haven't worked a day in your life!'
    Steven Wright

Similar Threads

  1. Does google follow target="_blank"
    By PowerPointSermons in forum Google Discussion Forum
    Replies: 1
    Last Post: 02-04-2010, 12:25 AM
  2. Anchor tag: target=_blank - relevance and PR feed/drain?
    By seiretto in forum Google Discussion Forum
    Replies: 11
    Last Post: 04-26-2009, 09:16 PM
  3. To _blank or to _new, that is the question
    By tombstoneweb in forum Graphics & Design Discussion Forum
    Replies: 27
    Last Post: 07-30-2008, 02:42 AM
  4. target="_blank" Google Maps
    By incrediblehelp in forum Google Discussion Forum
    Replies: 35
    Last Post: 09-07-2007, 06:29 PM
  5. Using javascript instead of target="_blank"
    By carbonize in forum Graphics & Design Discussion Forum
    Replies: 1
    Last Post: 11-29-2003, 07:55 PM

Posting Permissions

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