Sjoerd Visscher's weblog

My ideas about new web technology that can change the future of the world wide web.

Last Update

10/25/2002; 8:17:11 PM

Weblog Search

Don't like the look of this site?

XML coffee mug
Click to see the XML version of this web page.

Updated with

Click here to visit the Radio UserLand website.

Wednesday, May 15, 2002

A bad use of fragment identifiers?

I received an e-mail from Paul Sowden, with his comments about the URIs for dynamic pages article. It is an interesting e-mail, because Paul's conclusion is exactly the opposite of my opinion. I'm showing here a large part of the e-mail.

A fragment identifier is the part of the URI after the '#' sign and they are used to scroll to a specific point on the page.

This statement is wrong, the fragment identifier is not part of a URL or its parent family, URIs.

The problem with changing the url is that the browser will unload the current page and do a new http request.

This is obviously what you would expect, the different URL is pointing to a different location and as far as the client is concerned, a completely different document. It would be wrong for the client to behave otherwise.

There's one thing the web gurus agree on. It's axiom 0 in Tim Berners-Lee's web architecture: "Any resource of significance should be given a URI."

This statement stays true due to my above statement. Your article is implying otherwise, that a fragment identifier can be used to signify a different document.

I think it would be extremely bad behaviour to use the fragment identifier to refer to a document other than that at the URI. The fragment identifier is only meant to reference material inside of the document at the current URI. Using the behaviour you have described, whilst it could be made to degrade and universily work, would be very bad, imo.

I've found a page on the w3c site that says: Formally, the URI does include the fragment ID. So there's no factual error. But "URI reference" would have been the better term.

My article is not implying that a fragment identifier can be used to signify a different document. The trick is using the fragment identifier to signify the same document, but in a different state. I think this is a proper use of the fragment ID, certainly when comparing it to the examples in the same w3c document:

For example, for a 3D object the fragment ID could give a viewport. For a music object, the Fragment ID could give a section in time, or a set of parts, or it could include a suggested tempo.

I cannot think of a more appropriate use of the fragment ID with framesets than indicating which documents it is showing. And for dynamic pages the fragment ID should indicate as much of the state of the page as possible. My opinion is that is better to use the trick, than not using it. Not only from a usability viewpoint, but also from a technical, semantic viewpoint.