Re: A <BASE> question

Adrian John Howard (adrianh@cogs.susx.ac.uk)
Tue, 18 Oct 1994 09:20:23 +0100

> Could anybody please explain to me briefly and like
> I don't know anything about HTML in what way the <BASE> element works?

As I understand it the <base> element is used to specify the URL of the
document it occurs in. This allows it's "real" location to be found when
the document is read out of context. Any partial URLs are read within
the document are read relative to this URL.

> I know it allows the browser to resolve relative URLs within a document,
> but I still don't feel secure using it. I've been forced to do it in
> order to avoid keeping hundreds of GIFs and HTML documents in one
> directory. However, in a document where I put:
>
> <BASE HREF="www.blah.blah"> - the place where my "index.html" is kept

That is not a full URL. It should be something like:

<base href="http://www.blah.blah/">

> <A HREF="index.html">...</a> - a link back to Home Page
>
> my Mosaic browser returned an error: "failed to locate the host
> index.html". Why? Do I need to specify addresses in full form even though
> the <BASE> is used?

The above should work if you specify the base URL fully.

> Another problem, this time related to the new Mosaic Corporation browser,
> Netscape: when I use a <BASE> element like above and anchors within one
> document, like:
>
> <A HREF="#section">
> ...
> <A NAME="section">
>
> after clicking on the link it starts looking for a host
> "http://www.blah.blah#section"! This doesn't make any sense to me. Why
> should it treat a reference like #section exactly like a relative path?

I imagine this is because the "#section" is a partial URL which is
always relative to the URL of the current document. You have redefined
it as "www.blah.blah" so it's trying to find the document in that.

Hope this is clear.

> And, finally - since I can't help thinking it may be the case that I'm
> simply a long time behind - could you direct me to the freshest HTML and
> HTTP specs?

I find

http://info.cern.ch/hypertext/WWW/MarkUp/MarkUp.html

an invaluable starting point.

> Thanks for help.
> ....................................
> Grzesiek Staniak
> e-mail: gstaniak@golem.umcs.lublin.pl

Anyway, hope this helps.

Adrian

aids (adrianh@cogs.susx.ac.uk) ObDisclamer: Poplog used to pay my wages
Phone: +44 (0)273 678367 URL: http://www.cogs.susx.ac.uk/users/adrianh/