Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > single dot prefix for hyperlinks

Reply
Thread Tools

single dot prefix for hyperlinks

 
 
Dave
Guest
Posts: n/a
 
      09-21-2006
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

 
Reply With Quote
 
 
 
 
Andy Dingley
Guest
Posts: n/a
 
      09-21-2006

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
 
 
 
 
Brian Cryer
Guest
Posts: n/a
 
      09-21-2006
"Dave" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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
 
Brian Cryer
Guest
Posts: n/a
 
      09-21-2006
"Brian Cryer" <brian.cryer@127.0.0.1.ntlworld.com> wrote in message
news:(E-Mail Removed)...
> "Dave" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) 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
 
Michael Winter
Guest
Posts: n/a
 
      09-21-2006
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
 
richard
Guest
Posts: n/a
 
      09-21-2006

"Dave" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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
 
Jonathan N. Little
Guest
Posts: n/a
 
      09-21-2006
richard wrote:
>
> "Dave" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) 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
 
Alan J. Flavell
Guest
Posts: n/a
 
      09-21-2006
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
 
Jukka K. Korpela
Guest
Posts: n/a
 
      09-21-2006
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
 
Brian Cryer
Guest
Posts: n/a
 
      09-22-2006
"Jonathan N. Little" <(E-Mail Removed)> wrote in message
news:a36c5$4512f5b1$40cba7ac$(E-Mail Removed)...
> richard wrote:
>>
>> "Dave" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed) 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

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
removing a namespace prefix and removing all attributes not in that same prefix Chris Chiasson XML 6 11-14-2006 05:08 PM
How do you know what methods do not require a dot prefix me@mikehogan.net Ruby 4 06-02-2006 03:22 AM
Dynamically resize visible text and append dot dot dot (like gmail subject lines.. ) how to question? jawolter@gmail.com Javascript 6 12-12-2005 04:09 PM
"static" prefix - to parallel "this" prefix Tim Tyler Java 36 12-10-2004 01:02 AM
To dot or not to dot? SamuŽl van Laere HTML 8 10-16-2003 02:55 PM



Advertisments