How do I specify <a href="..." target="_blank">...</a> in XHTML STRICT?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tony Marston

    How do I specify <a href="..." target="_blank">...</a> in XHTML STRICT?

    The code
    <a href="..." target="_blank" >...</a>
    will not validate as XHTML STRICT because of the 'target' tag, so how do I
    achieve the same result by moving it to a CSS file? I cannot find anything
    which allows me to specify 'target=' on an anchor tag.

    --
    Tony Marston

    This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL




  • Johannes Koch

    #2
    Re: How do I specify &lt;a href=&quot;...& quot; target=&quot;_b lank&quot;&gt;. ..&lt;/a&gt; in XHTMLSTRICT?

    Tony Marston wrote:[color=blue]
    > The code
    > <a href="..." target="_blank" >...</a>
    > will not validate as XHTML STRICT because of the 'target' tag, so how do I
    > achieve the same result by moving it to a CSS file?[/color]

    With CSS you can't. But why not use a Transitional document type if you
    want to use deprecated 'features'?
    --
    Johannes Koch
    In te domine speravi; non confundar in aeternum.
    (Te Deum, 4th cent.)

    Comment

    • Steve Pugh

      #3
      Re: How do I specify &lt;a href=&quot;...& quot; target=&quot;_b lank&quot;&gt;. ..&lt;/a&gt; in XHTML STRICT?

      "Tony Marston" <tony@NOSPAM.de mon.co.uk> wrote:
      [color=blue]
      >The code
      > <a href="..." target="_blank" >...</a>
      >will not validate as XHTML STRICT because of the 'target' tag,[/color]

      Doesn't validate in HTML 4.01 Strict either.
      [color=blue]
      >so how do I
      >achieve the same result by moving it to a CSS file?[/color]

      <a href="..." class="whatever ">...</a>

      a.whatever {target-name: new; target-new: window; target-position:
      above;}

      But that's CSS3 and isn't supported by anything at the moment, so
      instead you either use a Transitional doctype or use JavaScript
      instead. Or why not let your visitors choose to open a new window if
      they want to, rather than trying to decide for them?

      Steve

      --
      "My theories appal you, my heresies outrage you,
      I never answer letters and you don't like my tie." - The Doctor

      Steve Pugh <steve@pugh.net > <http://steve.pugh.net/>

      Comment

      • Spartanicus

        #4
        Re: How do I specify &lt;a href=&quot;...& quot; target=&quot;_b lank&quot;&gt;. ..&lt;/a&gt; in XHTML STRICT?

        "Tony Marston" <tony@NOSPAM.de mon.co.uk> wrote:
        [color=blue]
        >The code
        > <a href="..." target="_blank" >...</a>[/color]

        Wrong group, crossposted and follow up set to
        comp.infosystem s.www.authoring.html
        [color=blue]
        >will not validate as XHTML STRICT because of the 'target' tag[/color]

        Attribute.
        [color=blue]
        >, so how do I
        >achieve the same result by moving it to a CSS file?[/color]

        CSS is for presentation.
        [color=blue]
        >I cannot find anything
        >which allows me to specify 'target=' on an anchor tag.[/color]

        Good, leave opening new windows/tabs to the user.

        --
        Spartanicus

        Comment

        • Jamie

          #5
          Re: How do I specify &lt;a href=&quot;...& quot; target=&quot;_b lank&quot;&gt;. ..&lt;/a&gt; in XHTMLSTRICT?



          Tony Marston wrote:
          [color=blue]
          > The code
          > <a href="..." target="_blank" >...</a>
          > will not validate as XHTML STRICT because of the 'target' tag, so how do I
          > achieve the same result by moving it to a CSS file? I cannot find anything
          > which allows me to specify 'target=' on an anchor tag.
          >[/color]

          Here's how:



          It requires Javascript, but the code seems pretty simple.

          Jamie

          Comment

          • David Dorward

            #6
            Re: How do I specify &lt;a href=&quot;...& quot; target=&quot;_b lank&quot;&gt;. ..&lt;/a&gt; in XHTML STRICT?

            Tony Marston wrote:
            [color=blue]
            > The code
            > <a href="..." target="_blank" >...</a>
            > will not validate as XHTML STRICT because of the 'target' tag[/color]

            Its an attribute, not a tag.

            Either:

            (1) Don't force new windows on visitors
            (2) Use Transitional
            (3) Use JavaScript


            --
            David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
            Home is where the ~/.bashrc is

            Comment

            • Tony Marston

              #7
              Re: How do I specify &lt;a href=&quot;...& quot; target=&quot;_b lank&quot;&gt;. ..&lt;/a&gt; in XHTML STRICT?

              Thanks. I'll look into it.

              --
              Tony Marston

              This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL



              "Jamie" <enzymatic2009@ yahoo.com> wrote in message
              news:410FCFE4.8 080406@yahoo.co m...[color=blue]
              >
              >
              > Tony Marston wrote:
              >[color=green]
              > > The code
              > > <a href="..." target="_blank" >...</a>
              > > will not validate as XHTML STRICT because of the 'target' tag, so how do[/color][/color]
              I[color=blue][color=green]
              > > achieve the same result by moving it to a CSS file? I cannot find[/color][/color]
              anything[color=blue][color=green]
              > > which allows me to specify 'target=' on an anchor tag.
              > >[/color]
              >
              > Here's how:
              >
              > http://www.sitepoint.com/article/1041
              >
              > It requires Javascript, but the code seems pretty simple.
              >
              > Jamie[/color]


              Comment

              Working...