URL != Application State

May 17th, 2006

With the buzz around AJAX reaching another high you will likely find yourself in a discussion about how to handle bookmarks. There are those who believe that every little bit of material which is available online should be accessible with a unique URL. At the other end of the spectrum, there are those who have no regard for the value for a URL and will hide all content behind generic URL. I find that you can truly go either way.

For example, consider Google Maps and Yahoo Maps. For years I have used Yahoo for my mapping needs, including driving directions. With my Yahoo profile I have associated a collection of locations like my home, work, brother, sister and client addresses so that I can quickly pull them up and generate myself some driving directions. And to access each of those locations I simply go to http://maps.yahoo.com/ and through the magic of cookies it gives me a list of my locations in the drop down list.

In contrast, Google Maps does not currently remember my locations through any mechanism within their website. Instead they offer a way to copy a permanent link which I can save as a bookmark or email to a friend. And when I go to the main page of Google Maps later, it does not list my previously viewed locations.

Which is better?

Both approaches work in most cases. Which is better depends on your requirements. For Yahoo Maps, the Application State is loaded from your Yahoo profile based on a cookie. The responsibility of persisting your personal settings is handled by the server and not a bookmark held by the browser. And your personal settings can be loaded up on another computer. There are many advantages to this approach. I use multiple computers during the week and to manage bookmarks between them I use Scuttle which uses the same approach as Yahoo Maps. The links I saved and tagged for myself at home are easily accessible while I am at work.

So why use a URL to represent Application State?

A URL makes it very easy to access a resource. If you want to share your mapped locations it is best shared as a simple URL someone can click. And while I can log into Scuttle to access my personal settings it also provides a friendly URL scheme to make my links easily available to others. I can easily share my list of blogs or AJAX links with a permanent URL. And the URL is something which is easy to remember or to write down on a stickie to be typed into another computer later.

My favorite example of URLs used properly is the Apple website. Whenever I want to find something on the Apple website I can simply guess and they help me out with a friendly URL. When you enter http://www.apple.com/ibook/ it will safely redirect your browser to the new MacBook page. Enter http://www.apple.com/downloads/ and you are redirected to MacOS X Downloads. Apple was the first website which made use of these friendly URLs. Even today if you try other sites, like Microsoft.com you get somewhat friendly but not as friendly URLs. Enter http://www.microsoft.com/office/ and you will be sent to http://office.microsoft.com/en-us/default.aspx. Enter http://www.microsoft.com/downloads/ and you are sent to http://www.microsoft.com/downloads/Search.aspx?displaylang=en. Not bad, but it could be better. I like a URL which makes sense to me at a glance. We go through all the trouble of finding a good domain name, so we should pay some attention to what paths we append to it.

What about Privacy?

A big shortcoming of a friendly URL is the lack of privacy. A URL which is easy to guess or remember could lead to me trolling flickr.com for random names. I do not know Dave, but I can find his Wedding Photos with no trouble. I am sure Dave intended to share these photos with his family and friends. Did he consider his privacy? Now anyone can see his trip to Belize for his honeymoon. (Looks like a great trip actually.) If he simply used a more obscure name he would have a little more privacy. A name like DaveAndLauren would have been an improvement which his family and friends should still remember easily. (What happened to Stacy. I liked her. :) )

The point here is that exposing Application State with a URL is not always the right approach, and sometimes it is a very bad approach.

Comments are closed.