|
Posted by Michael Winter on 09/21/06 15:11
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
[Back to original message]
|