Bookmarkability

Back in february when I wrote my first two tutorials on how to build an Ajax Portal, I explained how to make the pages bookmarkable. Bookmarks in Ajax Applications are very different from bookmarks in Web 1.0. In classic Web applications bookmarks pointed to a Resource (always remember that URI stands for Uniform Resource Identifier) and that was really why bookmarks were (and still are) so usefull, you could save the URL, come back later and find the same content, send it to a friend and he would see the same thing as you did, this sharing is really popular today (see Digg.com and del.icio.us). Bookmarks in Ajax Applications go far beyond this resource identification, they conceptually save the state of the Ajax Application itself, so that the state can be resumed at a later time. Going back to the example I used in the tutorials, the currently displayed content will certainly be important to save, so saving the currently displayed document in the URL is important, on the other hand the automagically updating list of online users is not context relevant and is not important to save to the URL. in fact the user list is volatile, updates independently from the page itself and would be a complete overkill to put into your URL. To sum it up:
KISS: Keep it simple stupid, don’t overload the URLs with useless state information that isn’t necessary. Creating too many differing URLs is not good coding style, keep them short and easy to remember, even better if it is something that makes sense.
The reason why I write this article is that just today I received a comment on my old tutorial asking how to save Form data in the URL. First of all: it wasn’t possible in Web 1.0, why should you want to in Web 2.0? Forms submitted with the POST-Method isn’t saved in classic URLs either, and we never complained about this. In Web 2.0 we now have to first answer a conceptual question: is the data sent from the Form worth saving to the URL? If I have a Registration Form I wouldn’t want a user to be able to save the Page after the Form, because it would mean that every time he opens this page it would issue a new Registration request. Where saving Form data may be relevant is a Search feature where the searchtherm is saved, but again this is no big deal because you can simply add a parameter to the URL. Although the difference may be subtle it is still important to keep this in mind, there are things that are nice to be bookmarkable, others aren’t, the question of what is best is to be answered by you when developing :)
Did you like this? Share it:

Leave a Reply