single dot prefix for hyperlinks

Discussion in 'HTML' started by Dave, Sep 21, 2006.

  1. Dave

    Dave Guest

    Hi,

    Can anyone tell me the difference between the following where
    "Test.asp" is found in the same folder as the target page calling the
    hyperlink "Last Image"?

    1. <a href="./Test.csp">Last Image</a>
    2. <a href="Test.asp">Last Image</a>

    Thanks in advance,
    Dave
     
    Dave, Sep 21, 2006
    #1
    1. Advertising

  2. Dave

    Andy Dingley Guest

    Dave wrote:

    > Can anyone tell me the difference between the following where
    > "Test.asp" is found in the same folder as the target page calling the
    > hyperlink "Last Image"?
    >
    > 1. <a href="./Test.csp">Last Image</a>
    > 2. <a href="Test.asp">Last Image</a>


    One is "csp"

    Otherwise the resolution of the URLs ought to point to the same
    directory. As to the actuality for your real server, then take the URL
    of this page (which you didn't tell us) and see what you get by
    following each link. The LiveHTTPHeaders extension for Firefox is worth
    using for this.
     
    Andy Dingley, Sep 21, 2006
    #2
    1. Advertising

  3. Dave

    Brian Cryer Guest

    "Dave" <> wrote in message
    news:...
    > Hi,
    >
    > Can anyone tell me the difference between the following where
    > "Test.asp" is found in the same folder as the target page calling the
    > hyperlink "Last Image"?
    >
    > 1. <a href="./Test.csp">Last Image</a>
    > 2. <a href="Test.asp">Last Image</a>
    >
    > Thanks in advance,
    > Dave


    One is two characters longer than the other.

    Seriously, I think that is the only difference. A single dot "." is a
    reference to the current directory (similar to ".." referring to the
    parent), so "./Test.csp" is the same as "Test.csp".
    --
    Brian Cryer
    www.cryer.co.uk/brian
     
    Brian Cryer, Sep 21, 2006
    #3
  4. Dave

    Brian Cryer Guest

    "Brian Cryer" <brian.cryer@127.0.0.1.ntlworld.com> wrote in message
    news:...
    > "Dave" <> wrote in message
    > news:...
    >> Hi,
    >>
    >> Can anyone tell me the difference between the following where
    >> "Test.asp" is found in the same folder as the target page calling the
    >> hyperlink "Last Image"?
    >>
    >> 1. <a href="./Test.csp">Last Image</a>
    >> 2. <a href="Test.asp">Last Image</a>
    >>
    >> Thanks in advance,
    >> Dave

    >
    > One is two characters longer than the other.
    >
    > Seriously, I think that is the only difference. A single dot "." is a
    > reference to the current directory (similar to ".." referring to the
    > parent), so "./Test.csp" is the same as "Test.csp".


    oops. Except, as pointed out by Andy, had I put my glasses on I would have
    noticed one was .csp and the other .asp. (silly me). Nevertheless,
    "./Test.csp" is the same as "Test.csp".
     
    Brian Cryer, Sep 21, 2006
    #4
  5. Dave wrote:

    > Can anyone tell me the difference between the following where
    > "Test.asp" is found in the same folder as the target page calling the
    > hyperlink "Last Image"?
    >
    > 1. <a href="./Test.csp">Last Image</a>
    > 2. <a href="Test.asp">Last Image</a>


    Ignoring the typo (".csp" vs. ".asp"), there is no difference. A single
    dot (.), as the only character in a path segment[1], simply refers to
    the "same" path segment. It's just stripped out, though it can be
    useful[2] on rare occasions.

    With a base URI of:

    http://www.example.com/foo/

    all of:

    bar/baz.html
    ./bar/baz.html
    bar/./baz.html
    ./bar/./baz.html

    resolve to:

    http://www.example.com/foo/bar/baz.html

    Section 5.4 Reference Resolution Examples of RFC 3986 shows several
    examples of dot-segment resolution.

    Mike


    [1] Along with "..", these are also known as dot-segments.
    [2] A relative-path reference cannot start with a path segment
    that contains a colon as this would look like a URI starting
    with a scheme:

    foo:bar/baz.html (scheme: "foo", path: "bar/baz.html")

    To make the relative nature of the reference explicit, it can
    be prefixed with a "." dot-segment:

    ./foo:bar/baz.html
     
    Michael Winter, Sep 21, 2006
    #5
  6. Dave

    richard Guest

    "Dave" <> wrote in message
    news:...
    > Hi,
    >
    > Can anyone tell me the difference between the following where
    > "Test.asp" is found in the same folder as the target page calling the
    > hyperlink "Last Image"?
    >
    > 1. <a href="./Test.csp">Last Image</a>
    > 2. <a href="Test.asp">Last Image</a>
    >
    > Thanks in advance,
    > Dave
    >


    Either can be used, but 2 distinctively tells the coding to look in this
    folder.
    As I've always understood it, the / means another folder or directory.
    The dot says, "backup one level then use this directory or folder".
    A leftover shortcut from DOS.
     
    richard, Sep 21, 2006
    #6
  7. richard wrote:
    >
    > "Dave" <> wrote in message
    > news:...
    >> Hi,
    >>
    >> Can anyone tell me the difference between the following where
    >> "Test.asp" is found in the same folder as the target page calling the
    >> hyperlink "Last Image"?
    >>
    >> 1. <a href="./Test.csp">Last Image</a>
    >> 2. <a href="Test.asp">Last Image</a>
    >>
    >> Thanks in advance,
    >> Dave
    >>

    >
    > Either can be used, but 2 distinctively tells the coding to look in this
    > folder.
    > As I've always understood it, the / means another folder or directory.
    > The dot says, "backup one level then use this directory or folder".
    > A leftover shortcut from DOS.
    >

    Close but not quite:

    one dot './' means this folder in DOS
    2 dots '../' means backup one level in DOS

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Sep 21, 2006
    #7
  8. On Thu, 21 Sep 2006, richard wrote:

    [otiose quotage snipped yet again. Isn't it time you started
    following good usenet netiquette?]

    > As I've always understood it, the / means another folder or
    > directory.


    No. URLs (which is what these are) define their own hierarchy, which,
    in principle, is completely independent of any server-specific file
    system, folders etc. The data might not be stored in ordinary files
    at all, but might be in a database, or be generated on-the-fly from
    some other source.

    In practice you will, of course, often find that the server is
    configured so that a certain sub-tree of the server's file hierarchy
    is mapped to a corresponding sub-tree of URLs, but this is by no means
    fundamental to the web. Quite the contrary, in fact (the URL
    hierarchy is not meant to expose internal details of web server file
    hierarchies etc.). As long as one misses this distinction, things may
    appear to be going just fine for quite a while, but sooner or later
    there will be a big surprise.

    > A leftover shortcut from DOS.


    I think the original designers of the URL scheme would quite resent
    your implications.
     
    Alan J. Flavell, Sep 21, 2006
    #8
  9. Andy Dingley wrote:

    > Otherwise the resolution of the URLs ought to point to the same
    > directory.


    No, the resolution of the relative URLs produces the same _absolute URL_.
    Whether the server happens to treat it as referring to a directory is just
    coincidental (see Alan Flavell's reply).

    > As to the actuality for your real server, then take the URL
    > of this page (which you didn't tell us) and see what you get by
    > following each link.


    The server is not involved in any way in the URL resolution business, which
    is just string manipulation carried out by the _browser_. Only after
    resolving the absolute URL will the browser try to contact the server, and
    the server only gets the resolved absolute URL (split into parts, but that's
    irrelevant here).

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Sep 21, 2006
    #9
  10. Dave

    Brian Cryer Guest

    "Jonathan N. Little" <> wrote in message
    news:a36c5$4512f5b1$40cba7ac$...
    > richard wrote:
    >>
    >> "Dave" <> wrote in message
    >> news:...
    >>> Hi,
    >>>
    >>> Can anyone tell me the difference between the following where
    >>> "Test.asp" is found in the same folder as the target page calling the
    >>> hyperlink "Last Image"?
    >>>
    >>> 1. <a href="./Test.csp">Last Image</a>
    >>> 2. <a href="Test.asp">Last Image</a>
    >>>
    >>> Thanks in advance,
    >>> Dave
    >>>

    >>
    >> Either can be used, but 2 distinctively tells the coding to look in this
    >> folder.
    >> As I've always understood it, the / means another folder or directory.
    >> The dot says, "backup one level then use this directory or folder".
    >> A leftover shortcut from DOS.
    >>

    > Close but not quite:
    >
    > one dot './' means this folder in DOS
    > 2 dots '../' means backup one level in DOS


    or UNIX.
    --
    Brian Cryer
    www.cryer.co.uk/brian
     
    Brian Cryer, Sep 22, 2006
    #10
  11. Brian Cryer wrote:
    > "Jonathan N. Little" <> wrote in message
    > news:a36c5$4512f5b1$40cba7ac$...
    >> richard wrote:


    <snip>

    >>> Either can be used, but 2 distinctively tells the coding to look in this
    >>> folder.
    >>> As I've always understood it, the / means another folder or directory.
    >>> The dot says, "backup one level then use this directory or folder".
    >>> A leftover shortcut from DOS.
    >>>

    >> Close but not quite:
    >>
    >> one dot './' means this folder in DOS
    >> 2 dots '../' means backup one level in DOS

    >
    > or UNIX.


    Yes true, but I was addressing richard's DOS statement.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Sep 22, 2006
    #11
    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. Tim Tyler
    Replies:
    36
    Views:
    1,467
    Darryl L. Pierce
    Dec 10, 2004
  2. Samuël van Laere

    To dot or not to dot?

    Samuël van Laere, Oct 16, 2003, in forum: HTML
    Replies:
    8
    Views:
    427
    Samuël van Laere
    Oct 16, 2003
  3. Chris  Chiasson
    Replies:
    6
    Views:
    621
    Richard Tobin
    Nov 14, 2006
  4. Replies:
    4
    Views:
    91
    joesb
    Jun 2, 2006
  5. Replies:
    6
    Views:
    251
    Thomas 'PointedEars' Lahn
    Dec 12, 2005
Loading...

Share This Page