Re: Is this use of BASE kosher?

Daniel W. Connolly (connolly@beach.w3.org)
Mon, 31 Jul 95 12:37:17 EDT

In message <199507300048.RAA17296@blob.best.net>, "Peter K. Sheerin" writes:
>I ran across someone with a very interesting document, that has a bunch of
>relative links that don't work, because of the presense of a BASE URL in
>the document header.
[...]
>
>The URL used here, though, points to an entirely different page -- one
>which doesn't contain the named sections specified in the relative URLs.

I'm having trouble determining exactly what your question is.
"kosher" and "doesn't work" aren't very well-defined terms.

Regarding the attached document excerpt, I can answer these
questions:

Q1. Is this a conforming HTML document?

A. first, is is a conforming SGML document?
well... it's got some errors. I'll change:
<link content="..."> => <link href="...">
<img name="..."> => <img >
quote some attribute values...

OK. now it's a conforming SGML document.

and I can't see that it violates any HTML rules, so yes, it's a
conforming HTML document (after the above fixes).

Q2. What is the address of the head of the link whose tail is "Support
and ..."

A2. http://www.hp.com/go/ftp-sites#Miscellaneous Support
aka
http://www.hp.com/go/ftp-sites#Miscellaneous%20Support

(space and %20 have identical semantics. Both are correct.)

now for the tricky part...

Q3. I've got this document in my browser, and I click on "Support
and ..." and it fetches a whole new document, and fails to find
the anchor in question. Is this conforming behaviour?

A3. Well, the HTML 2.0 spec doesn't really govern this sort of
thing, but it seems to be a pretty brain-dead implementation.

When the browser is viewing this document, regardless of where
it got the document, it should consider the document's address
to be: http://www.hp.com/go/ftp-sites .

So when it sees a link to "#Misc...", it may:

1. Resolve this partial URI into a full URI using the
BASE address, and resolve the resulting absolute URI.
(as per 7.2. "Activation of Hyperlinks" and 7.1. "Accessing Resources")
At this point, it should realize that it's already resolved
that URI, and it's got the document on screen. It need
only visit the anchor named "#Misc..."
(as per 7.4. "Fragment Identifiers").

or

2. It may go and fetche a new copy of the document.
If the new copy doesn't have the named anchor, then
this is an error. The implementation is still conforming --
the fault is the information provider's for not making the
information at the <base> address the same as the info in the
given document.

or

3. Bypass all that and realize that "#xxx" is _always_
a reference to the current document:

|7.4. Fragment Identifiers
|
| Any characters following a `#' character in a URI constitute a
| fragment identifier. As a degenerate case, a URI of the form
| `#fragment' refers to an anchor in the same document.

document in question follows:

I've added a test case to my test suite to cover this issue:

http://www.w3.org/hypertext/WWW/MarkUp/html-test/hyperlinks/base-frag.html

I'm trying to get back to my old methodology of representing issues
by test cases in my test suite. Stay tuned for details...

><html><head>
>
><base href="http://www.hp.com/go/ftp-sites">
>
><link rel="parent" href="/ftp-sites/Peripherals.html">
><link rel="coll-home" href="/ftp-sites/Peripherals.html">
><meta name="coll-banner" content="/ftp-sites/bb-ftp-peripherals.gif">
><meta name="reply-to" content="webmaster@www.hp.com">
><link rel="reply-link" content="/ahp/Comments.html">
><meta name="coll-name" content="ftp-sites">
><meta name="lm-id" content="ftp-sites">
><meta name="aliases" content="/Misc/Peripherals.html">
><title>HP Computer Product and Peripherals Anonymous FTP Site</title>
></head><body>
>
><a href="/ftp-sites/Peripherals.html">
><img name="TOP"
> src=/ftp-sites/bb-ftp-peripherals.gif></a>
><a href="/cgi-bin/imagemap/ftp-sites/ftp-sites_Peripherals-T.map">
> <img src=/Graphics/TopRight.gif ISMAP></a>
> <p>
><h2> Quick Scroll to: </h2>
>
><ul>
>
><li> <a href="#Miscellaneous Support"><b>Support and Utility Files</b></a>
><li> <a href="#HP NetServer Computer Products"><b>HP NetServer Computer
> Products</b></a>
>
></ul>
>
><hr>
><a name="Miscellaneous Support"><h3>Support and Utility Files</h3></a>
>
><ul>
>
><li> <a href="ftp://ftp-boi.external.hp.com/pub/miscellaneous_support">
> Miscellaneous Support and Utility Files</a>
>
></ul>
>
><a name="HP NetServer Computer Products"><h3>HP NetServer Computer
>Products</h3></a>
>
><ul>
>
><li><a href="ftp://ftp-boi.external.hp.com/pub/computer_products/netserver/net
>server_lc">HP NetServer LC Files</a>
><li><a href="ftp://ftp-boi.external.hp.com/pub/computer_products/netserver/net
>server_le">HP NetServer LE Files</a>
><li><a href="ftp://ftp-boi.external.hp.com/pub/computer_products/netserver/net
>server_lf">HP NetServer LF Files</a>
><li><a href="ftp://ftp-boi.external.hp.com/pub/computer_products/netserver/net
>server_lm">HP NetServer LM Files</a>
><li><a href="ftp://ftp-boi.external.hp.com/pub/computer_products/netserver/doc
>"> HP NetServer Support Information</a>
>
></ul>
>
><a name="HP Vectra Computer Products"><h3>HP Vectra Computer
>Products</h3></a>
>
><ul>
><li> <a href="ftp://ftp-boi.external.hp.com/pub/computer_products/vectra_rs_qs
>_es">
> HP Vectra RS QS and ES Computer Files</a>
><li> <a href="ftp://ftp-boi.external.hp.com/pub/computer_products/netserver/48
>6_eisa">
> HP Vectra 486 EISA Computer Files</a>
><li> <a href="ftp://ftp-boi.external.hp.com/pub/computer_products/vectra_486_p
>entium">
> HP Vectra 486 and Pentium Computer Files</a>
><li> <a href="ftp://ftp-boi.external.hp.com/pub/computer_products/pc_video">
> HP PC Video Files</a>
><li> <a href="ftp://ftp-boi.external.hp.com/pub/computer_products/scsi_host_ad
>apter">
> HP SCSI Host Adapter Files</a>
><li> <a href="ftp://ftp-boi.external.hp.com/pub/computer_products/vectra_doc">
> HP Vectra Support Information</a>
></ul>
>
>
><!-- End Body -->
>
>
>
>
><p>
><p><a href=#TOP><img src=/Graphics/BottomLeft.gif></a>
><a href=/cgi-bin/imagemap/ftp-sites/ftp-sites_Peripherals-B.map>
> <img src=/Graphics/BottomRight.gif ISMAP></a>
><h4>
><a href="#TOP">Top</a> |
><a href="/AccessGuide/AccessGuide.html">Access Guide</a> |
><a href="/AccessGuide/Search.html">Search</a> |
><a href="/ftp-sites/Peripherals.html">Up</a> |
><a href="/home.html">Access HP</a>
></h4>
>
>
><h5>
><a href=/ahp/Comments.html>Contact webmaster@www.hp.com</a>
>with questions or problems with this service.
><br><A href=/ahp/HPCopyright-95.html>
>(c) Copyright 1995 Hewlett-Packard Company.</A>
></h5>
></body>
></html>