W3C home > Mailing lists > Public > www-html@w3.org > December 2001

Re: anchors

From: Vix <vixcc@yahoo.com>
Date: Sun, 2 Dec 2001 15:12:49 -0800 (PST)
Message-ID: <20011202231249.37867.qmail@web21102.mail.yahoo.com>
To: "Hoyt, Phil" <Phil.Hoyt@globeinteractive.com>, www-html@w3.org

--- "Hoyt, Phil" <Phil.Hoyt@globeinteractive.com> wrote:
> I think it's common practice to link using href="#name" to an anchor within
> the same document. I've been unable, though, to find a way either in the
> real world or in the html spec to use a similar syntax to link to an anchor
> within the same document as the link when <base href="http://www.url.com">
> is being used. Instead, such a link refers to an anchor on the base
> document.
> Adding a ./ in front of the # has no effect and the spec doesn't seem to
> insist that it should. 


I think that the Spec is clear about that.
A BASE href is meant to be the basis for all HREFs without a BASE explicitly declared in their
HREF section.

Thus, having the tag <a href="#top">, with a BASE HREF="http://www.url.com/", this means that the
anchor must be appended to the BASE in this case. This ends up as: http://www.url.com/#top

So far was only meant to discuss the SPEC part.
Going back to being able to specify #anchors inside your document, there are TWO ways that I know
of, even if you're using BASE hrefs.

1- Have the URL explicitly declared with the anchor. <a href="http://thisfile.com/#top">link

2- Use a javascript function to fill in the Document.location at run-time if you don't know the
file name or if you are afraid that the file name might be changed without the HREF updated as

I hope the above helps.

Best regards,


------> tAke a bReak! gEt eNtertained!
------> http://www.sallini.com/
-> http://netdesignplus.net/
-> It works... It Pays...

Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
Received on Sunday, 2 December 2001 18:12:50 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:05:58 UTC