Empty fragment

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Harlan Messinger

    Empty fragment

    Is the following a legal URL?



    This underlies my real questions:

    1. Is <a href="#"> a *valid* (whether or not intentionally) way to go to
    the top of a page.

    2. Whether or not valid, do the usual browsers actually support this?

    I'm asking because I'm reviewing a large set of pages created by several
    other people, and many of them are using this device to return to the
    top of the page. (No need to reopen the argument about not using Back to
    Top links at all--not my decision!)
  • David Håsäther

    #2
    Re: Empty fragment

    Harlan Messinger <hmessinger.rem ovethis@comcast .net> wrote:
    [color=blue]
    > Is the following a legal URL?
    >
    > http://www.invalid.com/path#[/color]

    Yes.
    [color=blue]
    > This underlies my real questions:
    >
    > 1. Is <a href="#"> a *valid* (whether or not intentionally) way to
    > go to the top of a page.[/color]

    AFAIK, the behavior is undefined for empty fragment identifiers. I'm
    not sure though, so you may want to look into RFC 2396 (somewhere
    around section 4 maybe).
    [color=blue]
    > 2. Whether or not valid, do the usual browsers actually support
    > this?[/color]

    IE, Mozilla and Opera does to my knowledge, and I think this is the
    most common behavior for browswers.

    --
    David Håsäther

    Comment

    • Harlan Messinger

      #3
      Re: Empty fragment

      David Håsäther wrote:[color=blue]
      > Harlan Messinger <hmessinger.rem ovethis@comcast .net> wrote:
      >[color=green]
      >>Is the following a legal URL?
      >>
      >> http://www.invalid.com/path#[/color][/color]

      I guess that should be either www.example.com or www.something.invalid.
      [color=blue]
      >
      > Yes.
      >[color=green]
      >>This underlies my real questions:
      >>
      >>1. Is <a href="#"> a *valid* (whether or not intentionally) way to
      >>go to the top of a page.[/color]
      >
      > AFAIK, the behavior is undefined for empty fragment identifiers. I'm
      > not sure though, so you may want to look into RFC 2396 (somewhere
      > around section 4 maybe).[/color]

      Yeah, it still doesn't seem to answer the question.
      [color=blue][color=green]
      >>2. Whether or not valid, do the usual browsers actually support
      >>this?[/color]
      >
      > IE, Mozilla and Opera does to my knowledge, and I think this is the
      > most common behavior for browswers.[/color]

      I just checked: even Lynx does.

      Comment

      • Jukka K. Korpela

        #4
        Re: Empty fragment

        Harlan Messinger <hmessinger.rem ovethis@comcast .net> wrote:
        [color=blue][color=green][color=darkred]
        >>>1. Is <a href="#"> a *valid* (whether or not intentionally) way to
        >>>go to the top of a page.[/color]
        >>
        >> AFAIK, the behavior is undefined for empty fragment identifiers.
        >> I'm not sure though, so you may want to look into RFC 2396
        >> (somewhere around section 4 maybe).[/color]
        >
        > Yeah, it still doesn't seem to answer the question.[/color]

        RFC 2396 has been superseded by RFC 3986 (STD 66) in January 2005.

        I haven't studied RFC 3986 in detail, but it seems to have obscured
        things somewhat. The one-character string "#" is surely a syntactically
        correct URL, but its meaning is not explicitly defined.

        P.S. "Valid" is not the right word here; e.g.
        <a href="! ¤¤ ##%">foo</a>
        is valid but incorrect.

        --
        Yucca, http://www.cs.tut.fi/~jkorpela/
        Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

        Comment

        • John Dunlop

          #5
          Re: Empty fragment

          Harlan Messinger wrote:
          [color=blue]
          > Is the following a legal URL?
          >
          > http://www.invalid.com/path#[/color]

          doesn't violate STD66 anyway.
          [color=blue]
          > This underlies my real questions:
          >
          > 1. Is <a href="#"> a *valid* (whether or not intentionally) way to go to
          > the top of a page.[/color]

          valid, and moreover conforms to the text of the spec, read
          loosely.

          My take on it is, in a text/html doc, an empty fragment
          designates an element named with the empty string (so that
          element can't be named with 'id'). If that element doesn't
          occur, the semantics of the fragment identifier are unknown.
          [color=blue]
          > 2. Whether or not valid, do the usual browsers actually support this?[/color]

          My Lynx (2.8.3) moves me to the top, no matter if an element's
          named "" or not; but my Opera (7.54) does not move me to the
          top, although if an element is named "" (even with 'id', which
          violates the spec), it moves me there.

          --
          Jock

          Comment

          • Big Bill

            #6
            Re: Empty fragment

            On Tue, 12 Jul 2005 20:07:30 GMT, John Dunlop
            <usenet+2004@jo hn.dunlop.name> wrote:
            [color=blue]
            >Harlan Messinger wrote:
            >[color=green]
            >> Is the following a legal URL?
            >>
            >> http://www.invalid.com/path#[/color]
            >
            >doesn't violate STD66 anyway.
            >[color=green]
            >> This underlies my real questions:
            >>
            >> 1. Is <a href="#"> a *valid* (whether or not intentionally) way to go to
            >> the top of a page.[/color]
            >
            >valid, and moreover conforms to the text of the spec, read
            >loosely.
            >
            >My take on it is, in a text/html doc, an empty fragment
            >designates an element named with the empty string (so that
            >element can't be named with 'id'). If that element doesn't
            >occur, the semantics of the fragment identifier are unknown.
            >[color=green]
            >> 2. Whether or not valid, do the usual browsers actually support this?[/color]
            >
            >My Lynx (2.8.3) moves me to the top, no matter if an element's
            >named "" or not; but my Opera (7.54) does not move me to the
            >top, although if an element is named "" (even with 'id', which
            >violates the spec), it moves me there.[/color]

            How come you're sensible over here?

            BB
            --
            www.kruse.co.uk/ seo@kruse.demon .co.uk
            seo that watches the river flow...
            --

            Comment

            Working...