This post originated from an RSS feed registered with Web Buzz
by Stuart Langridge.
Original Post: Back button and Undo in Ajax applications
Feed Title: as days pass by
Feed URL: http://feeds.feedburner.com/kryogenix
Feed Description: scratched tallies on the prison wall
Alex has been working with the Back button in Ajax applications as part of the Dojo toolkit. Thinking about this, in an Ajax application, I think that Back and Forward map to Undo and Redo. Sort of. What I’m trying to decide is, if you could implement Undo on the Back button and Redo on the Forward, would this actually be a good idea? Does that break the semantic of what those buttons mean? I don’t think that it does, because “do an action” means, in a web browser, “click a link“, pretty much. (Or possibly “drag something“, but in general it’s “click something“.) People are used, on the web, to thinking “click on this…and the Back button takes me back to where I was before I clicked it“. So, clicking something in an Ajax app, which doesn’t actually navigate to a new page but instead just does something, would be “undone” by clicking Back, because the semantic is “the Back button takes me back to where I was before I clicked that last thing“.
This will likely annoy serious web developers, because they know that Back doesn’t mean “return to the state before the last click“, it means “go back to the previous page” (modulo frame-ish things). But that’s because an Ajax application isn’t like the web-as-was; “Back” and “Forward” don’t make that much sense when the page metaphor is broken anyway.
Note that I’m not talking about implementation detail here; Alex’s method seems to be the approach. But essentially what Ajax apps could do is provide an “undo stack” in the same way as client apps do; the implementation of making the back/forward buttons trigger this is then simply a call to one of Alex’s iframes when you move back or forward in the stack, and every action needs to write itself into the undo stack so that it can be undone.
This is rather rambly. I need to work up a demo to explain what I mean, perhaps.