Go Back   Velocity Reviews > Newsgroups > HTML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

HTML - single dot prefix for hyperlinks

 
Thread Tools Search this Thread
Old 09-21-2006, 02:58 PM   #1
Default single dot prefix for hyperlinks


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
  Reply With Quote
Old 09-21-2006, 03:59 PM   #2
Andy Dingley
 
Posts: n/a
Default Re: single dot prefix for hyperlinks


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.

  Reply With Quote
Old 09-21-2006, 04:02 PM   #3
Brian Cryer
 
Posts: n/a
Default Re: single dot prefix for hyperlinks

"Dave" <> wrote in message
news: oups.com...
> 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


  Reply With Quote
Old 09-21-2006, 04:09 PM   #4
Brian Cryer
 
Posts: n/a
Default Re: single dot prefix for hyperlinks

"Brian Cryer" <> wrote in message
news:...
> "Dave" <> wrote in message
> news: oups.com...
>> 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".


  Reply With Quote
Old 09-21-2006, 04:11 PM   #5
Michael Winter
 
Posts: n/a
Default Re: single dot prefix for hyperlinks

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
  Reply With Quote
Old 09-21-2006, 08:42 PM   #6
richard
 
Posts: n/a
Default Re: single dot prefix for hyperlinks


"Dave" <> wrote in message
news: oups.com...
> 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.

  Reply With Quote
Old 09-21-2006, 09:27 PM   #7
Jonathan N. Little
 
Posts: n/a
Default Re: single dot prefix for hyperlinks

richard wrote:
>
> "Dave" <> wrote in message
> news: oups.com...
>> 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
  Reply With Quote
Old 09-21-2006, 09:45 PM   #8
Alan J. Flavell
 
Posts: n/a
Default Re: single dot prefix for hyperlinks

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.
  Reply With Quote
Old 09-21-2006, 10:04 PM   #9
Jukka K. Korpela
 
Posts: n/a
Default Re: single dot prefix for hyperlinks

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/

  Reply With Quote
Old 09-22-2006, 11:28 AM   #10
Brian Cryer
 
Posts: n/a
Default Re: single dot prefix for hyperlinks

"Jonathan N. Little" <> wrote in message
news:a36c5$4512f5b1$40cba7ac$...
> richard wrote:
>>
>> "Dave" <> wrote in message
>> news: oups.com...
>>> 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


  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump