Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

fragment identifier - named anchor plus query string in one url

Strange behaviour of the browser in the case of fragment identifier



1:54 pm on Jul 30, 2004 (gmt 0)

Inactive Member
Account Expired


I just cannot find any sufficient documentation about URL with fragment identifier inside. Some examples:

Correct URL's :
1. www.aaa.com/bbb/ccc.html#ddd
2. www.aaa.com/bbb/ccc.html?eee=ddd&fff=ggg&#ddd

BUT both EI and Mozilla show that:

Wrong URL :
3. www.aaa.com/bbb/ccc.html#ddd?eee=ddd&fff=ggg

It looks like that fragment identifier should be in the end of URL. I Looked through RFC's, but it looks like they treat (3) as a well-formed URL and give no hint why (2) is correct. May be there is a new one that explains such kind of behavior.


6:57 pm on Aug 3, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member blobfisk is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Feb 25, 2002
votes: 0

Welcome to WebmasterWorld, Andrey_R!

An interesting question.

To me (3) looks incorrect as you are pointing at a URL that is accepting some variables, and also asking the browser to go straight to the named anchor on that page.

However, they may be treating the # as part of the url querystring variable, rather than a named anchor, although the browser may be clever enough to split the named anchor from the URL encoded querystring.

(1) is perfectly formed and (2) looks like the browser will either treat the #ddd as part of the querystring or as a named anchor.

Anyone able to shed more authoratitive light on this?

7:32 pm on Aug 3, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 22, 2002
votes: 0

What about this?


I've been wondering about that. I've been using the /index.ext#foo style for lack of testing if the other will work.

3:28 pm on Sept 9, 2004 (gmt 0)

New User

10+ Year Member

joined:Sept 9, 2004
votes: 0

Section 4 in RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt) clearly states:

"The term "URI-reference" is used here to denote the common usage of a
resource identifier. A URI reference may be absolute or relative,
and may have additional information attached in the form of a
fragment identifier. However, "the URI" that results from such a
reference includes only the absolute URI after the fragment
identifier (if any) is removed and after any relative URI is resolved
to its absolute form."

In other words, according to the RCF the URL is split by the fragment identifier first (#), if present, and *then* parsed as an address. It's therefore imperative that the fragment identifier is placed last in the URL, which may also be combined with a query string as in:


Above example works in NN and IE and complies with the RFC as a valid URL.

[example.com...] does also work but has no bearing on the issue at hand, the last "&" is treated merely as an incomplete query string and discarded once the fragment identifier is separated from the URL during initial parsing of the URL.

site.com/folder/#foo mentioned by Birdman above should be correct according to the RFC...



Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members