converting to STRICT (href values and target attribute)

Discussion in 'HTML' started by petermichaux@gmail.com, Oct 1, 2006.

  1. Guest

    Hi,

    I am converting an old page to STRICT.

    When validating the page I learned that I can't have a link like the
    following. The '&' and '=' characters are not allowed? How can I make
    this link validate?

    <a
    href="http://www.foo.com/cgi-bin/test.pl?ACCOUNT=1006458&THE_BUTTON=display_page&PAGE_TYPE=MI_PPC#ASDF">


    I also learned that I can't use the "target" attribute in STRICT pages
    like the following. What do I do to get around this? Do I have to write
    JavaScript in the onclick attribute? That wouldn't be so good if
    JavaScript is off.

    <a href="http://www.7Search.com/" target="new">7Search.com</a>

    Thank you,
    Peter
     
    , Oct 1, 2006
    #1
    1. Advertising

  2. dorayme Guest

    In article
    <>,
    wrote:

    > Hi,
    >
    > I am converting an old page to STRICT.
    >
    > When validating the page I learned that I can't have a link like the
    > following. The '&' and '=' characters are not allowed? How can I make
    > this link validate?
    >
    > <a
    > href="http://www.foo.com/cgi-bin/test.pl?ACCOUNT=1006458&THE_BUTTON=display_pa
    > ge&PAGE_TYPE=MI_PPC#ASDF">
    >
    >


    Best to post the url for this as email and ng postings can pay
    tricks on url presentations

    > I also learned that I can't use the "target" attribute in STRICT pages
    > like the following. What do I do to get around this? Do I have to write
    > JavaScript in the onclick attribute? That wouldn't be so good if
    > JavaScript is off.
    >
    > <a href="http://www.7Search.com/" target="new">7Search.com</a>
    >


    Not heard of "new" as a value here? Don't use strict if you need
    target. You using frames?

    --
    dorayme
     
    dorayme, Oct 1, 2006
    #2
    1. Advertising

  3. Guest

    dorayme wrote:
    > In article
    > <>,
    > wrote:
    >
    > > I am converting an old page to STRICT.
    > >
    > > When validating the page I learned that I can't have a link like the
    > > following. The '&' and '=' characters are not allowed? How can I make
    > > this link validate?
    > >
    > > <a
    > > href="http://www.foo.com/cgi-bin/test.pl?ACCOUNT=1006458&THE_BUTTON=display_pa
    > > ge&PAGE_TYPE=MI_PPC#ASDF">

    >
    > Best to post the url for this as email and ng postings can pay
    > tricks on url presentations


    I'm not sure what you mean. The URL has a '?' followed by parameters
    like this

    ACCOUNT=1006458&THE_BUTTON=display_page

    http://www.foo.com/cgi-bin/test.pl?ACCOUNT=1006458&THE_BUTTON=display_page&PAGE_TYPE=MI_PPC#ASDF

    The ampersands and equals signs are apparently not allowed with the
    strict doctype.


    > > I also learned that I can't use the "target" attribute in STRICT pages
    > > like the following. What do I do to get around this? Do I have to write
    > > JavaScript in the onclick attribute? That wouldn't be so good if
    > > JavaScript is off.
    > >
    > > <a href="http://www.7Search.com/" target="new">7Search.com</a>
    > >

    >
    > Not heard of "new" as a value here? Don't use strict if you need
    > target. You using frames?


    I'm not using frames. The target is for a new window that may already
    be open. For example, if I have the following in a page then the first
    click opens a new window. More clicks change that same new window.

    <p><a href="http://www.google.com" target="foo">google.com</a></p>
    <p><a href="http://www.yahoo.com" target="foo">yahoo.com</a></p>

    How to convert this kind of behavior to strict doctype?

    Thanks,
    Peter
     
    , Oct 1, 2006
    #3
  4. dorayme Guest

    In article
    <>,
    wrote:

    > dorayme wrote:
    > >
    > > Best to post the url for this as email and ng postings can pay
    > > tricks on url presentations

    >
    > I'm not sure what you mean.


    Just that you should try to put up your efforts on a server so we
    can see what you are doing, you give us an address of where to
    look.

    > > >
    > > > <a href="http://www.7Search.com/" target="new">7Search.com</a>
    > > >

    > >
    > > Not heard of "new" as a value here? Don't use strict if you need
    > > target. You using frames?

    >
    > I'm not using frames. The target is for a new window that may already
    > be open. For example, if I have the following in a page then the first
    > click opens a new window. More clicks change that same new window.
    >
    > <p><a href="http://www.google.com" target="foo">google.com</a></p>
    > <p><a href="http://www.yahoo.com" target="foo">yahoo.com</a></p>
    >
    > How to convert this kind of behavior to strict doctype?


    Where did you get the idea to use the word "new"? I may be
    missing something.

    If you want a link to open in a new window, you can use the
    construction <a href="destination.html" target="_blank">

    You can use this in docs with

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">

    They will not validate. This is not the end of the world. You can
    still do it. Many browsers will not blink and it will work as you
    want.

    Your other choice is to use a transitional doc type.

    The other thing you can do, and this is generally the best thing
    to do: review your wanting to control the windows of website
    user. Now that there is tabbed browsing and greater familiarity
    with browsers, it is often best to simply leave all this stuff to
    the user. This is another reason a URL is desirable. So your
    business can be seen completely and we can poke our noses in and
    say what is what and how things should or should not be. :)

    --
    dorayme
     
    dorayme, Oct 1, 2006
    #4
  5. richard Guest

    <> wrote in message
    news:...
    > Hi,
    >
    > I am converting an old page to STRICT.
    >
    > When validating the page I learned that I can't have a link like the
    > following. The '&' and '=' characters are not allowed? How can I make
    > this link validate?
    >
    > <a
    > href="http://www.foo.com/cgi-bin/test.pl?ACCOUNT=1006458&THE_BUTTON=display_page&PAGE_TYPE=MI_PPC#ASDF">
    >
    >
    > I also learned that I can't use the "target" attribute in STRICT pages
    > like the following. What do I do to get around this? Do I have to write
    > JavaScript in the onclick attribute? That wouldn't be so good if
    > JavaScript is off.
    >
    > <a href="http://www.7Search.com/" target="new">7Search.com</a>
    >
    > Thank you,
    > Peter
    >


    The validator generally gives you some reasons why the error occurred. Read
    up on them.

    In general, &amp is best used instead of just &.
    "new" should be _blank.
    You should take the time to learn what attributes go with which terms.
    learn the basics of coding.
     
    richard, Oct 1, 2006
    #5
  6. On Sun, 1 Oct 2006 03:53:38 +0100, richard wrote
    (in article <>):

    >
    > <> wrote in message
    > news:...
    >> Hi,
    >>
    >> I am converting an old page to STRICT.
    >>
    >> When validating the page I learned that I can't have a link like the
    >> following. The '&' and '=' characters are not allowed? How can I make
    >> this link validate?
    >>
    >> <a
    >> href="http://www.foo.com/cgi-bin/test.pl?ACCOUNT=1006458&THE_BUTTON=display_
    >> page&PAGE_TYPE=MI_PPC#ASDF">
    >>
    >>
    >> I also learned that I can't use the "target" attribute in STRICT pages
    >> like the following. What do I do to get around this? Do I have to write
    >> JavaScript in the onclick attribute? That wouldn't be so good if
    >> JavaScript is off.
    >>
    >> <a href="http://www.7Search.com/" target="new">7Search.com</a>
    >>
    >> Thank you,
    >> Peter
    >>

    >
    > The validator generally gives you some reasons why the error occurred. Read
    > up on them.
    >
    > In general, &amp is best used instead of just &.


    You have forgotten the semi-colon: it should be &amp;

    To the OP: I like this chart which I find clearer than some:

    <http://www.cookwood.com/entities/#punctuation>



    --
    Sally in Shropshire, UK
    bed and breakfast near Ludlow: http://www.stonybrook-ludlow.co.uk
    Burne-Jones/William Morris window in Shropshire church:
    http://www.whitton-stmarys.org.uk
     
    Sally Thompson, Oct 1, 2006
    #6
  7. In article <>,
    wrote:

    > Hi,
    >
    > I am converting an old page to STRICT.
    >
    > When validating the page I learned that I can't have a link like the
    > following. The '&' and '=' characters are not allowed? How can I make
    > this link validate?
    >
    > <a
    > href="http://www.foo.com/cgi-bin/test.pl?ACCOUNT=1006458&THE_BUTTON=display_pa
    > ge&PAGE_TYPE=MI_PPC#ASDF">


    http://www.example.com/cgi-bin/test.pl?ACCOUNT=1006458&amp;THE_BUTTON=dis
    play_page&amp;PAGE_TYPE=MI_PPC#ASDF

    .... Should make the validator happier.

    Why? Suppose your URL looked like this instead:

    http://www.example.com/cgi-bin/test.pl?ACCOUNT=1006458&COPY=2&PAGE_TYPE=M
    I_PPC#ASDF

    &copy is a defined character entity in HTML. The href value in a link is
    CDATA, and browsers are supposed to interpret CDATA:

    "CDATA is a sequence of characters from the document character set and
    may include character entities. User agents should interpret attribute
    values as follows:
    * Replace character entities with characters,
    * Ignore line feeds,
    * Replace each carriage return or tab with a single space."

    (http://www.w3.org/TR/html401/types.html#type-cdata)

    So your browser would be strongly tempted to replace the &COPY in the
    above URL with a copyright symbol character ... and that's probably not
    what you want.

    Use &amp; instead of & in URLs to separate parameters: browsers will
    handle it properly and you'll avoid risk of unintended interpretation.

    > I also learned that I can't use the "target" attribute in STRICT pages
    > like the following. What do I do to get around this? Do I have to write
    > JavaScript in the onclick attribute?


    Yes.

    > That wouldn't be so good if JavaScript is off.


    True, but if the user turned it off, he/she probably knows how to open
    pages in new windows/tabs/whatever anyways. If the user isn't human, it
    doesn't care.

    --
    Joel.
     
    Joel Shepherd, Oct 1, 2006
    #7
  8. Guest

    richard:

    > In general, &amp is best used instead of just &.


    although if a Name character follows, the entity reference must be
    closed explicitly, with a semi-colon.

    > "new" should be _blank.


    They mean different things. With 'new', user-agents SHOULD either load
    the resource in a new frame named 'new' or if a frame named 'new'
    already exists, load the resource in that frame. The spec talks about
    known and unknown frames here. With '_blank', they SHOULD load the
    resource in a 'new, unnamed window', regardless of existing frames.
    All that assumes that the user-agent understands 'target', that it
    doesn't override the attribute, and that there are such things as
    frames and windows.

    --
    Jock
     
    , Oct 1, 2006
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TheKeith
    Replies:
    9
    Views:
    1,163
    Leif K-Brooks
    Oct 22, 2003
  2. Joshua Beall
    Replies:
    4
    Views:
    647
    Joshua Beall
    Apr 19, 2004
  3. Simon
    Replies:
    21
    Views:
    3,873
    Lauri Raittila
    Oct 31, 2004
  4. saiho.yuen
    Replies:
    3
    Views:
    438
    kaeli
    Sep 14, 2004
  5. Replies:
    2
    Views:
    482
Loading...

Share This Page