Ajax and browser history

April 7th, 2008

This is something that we – developers – don’t pay much attention. “Ajaxy” apps keep changing the content/state and once the user navigates somewhere else, she looses everything when going back to “that” page.

You might want to design in a way that the user never navigates off (awful), you might provide something that somewhat replaces the bookmarking ability of the browser, and you can keep inventing things to circumvent the very nature of web apps. It all comes down when you realize that the most used button on the web browser is the BACK button.

My attempt to deal with this was, like always, searching for a jquery plugin that handles history. I found two, but they are very limited. I was about to start to write my own when I bumped into YUI Browser History Manager. No idea on how well it will play with jQuery.. but seems very complete.

7 Responses to “Ajax and browser history”

josh Says:

Hammett, what’s the latest with jquery and MR? I’m planning on adding an ajax contact form to my site which uses MR. Do you have some helpers make controller methods ajax-enabled and jquery friendly?

hammett Says:

I don’t follow. What needs to be changed to make it jquery friendly?

josh Says:

i dont know that anything needs changed.. i just started reading on it, and saw a couple articles on making controller methods ajax aware. i recall you previously posting about MR being to tightly tied to prototype. I was thinking of using ajaxpro as a helper for calling the server side methods I want.

hammett Says:

Hmm, the information scattered around can be confusing. I’ll try to clarify things somehow.

Torkel Says:

Didn’t you make the MonoRail javascript framework independent? This post describes a jquery & monorail setup: http://hammett.castleproject.org/?p=238

hammett Says:

That’s right. But I can see how all that information can be confusing to some users…

Christopher Bennage Says:

One caveat about some of the technique to make the back button work is that it can produce links that are not search engine friendly. We ran into this on a recent project.

Leave a Reply