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. 
> 
> 

Phil,

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
here</a?

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
well.

I hope the above helps.

Best regards,

Vix!



=====
_,.~=`^`=~.,_,.~=`^`=~.,_,.~=`^`=~.,
------> 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.
http://shopping.yahoo.com
Received on Sunday, 2 December 2001 18:12:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:15:50 GMT