An ASPAjaxWikiBlog Thingy

March 7, 2006

Back buttons in AJAX

Filed under: General

Any AJAX Application, which does not reload the page will cause grief to the poor user who clicks their back button:

  1. They expect the last state to appear
  2. They won’t even be on the current page anymore

The workaround for this is to use several very clever tricks (1 for each browser) to provide a history path. The main aspects are:

  1. Using a hidden IFrame to "fool2 the browser into generating a history
  2. Saving state in the page’s hash (#) or fragment anchor
  3. Reading the state from the hash and updating accordingly

It’s all rather complicated under the hood but luckily there’s such a thing as the Really Simple History which hides the complexity and provides all you need for most cool browsers.

You still need to call it’s dhtmlHistory.add() method each time your app changes state and remember to add your own listener for catching history changes by the user -> dhtmlHistory.addListener(myFunc).

Get free blog up and running in minutes with Blogsome
Theme designed by Jay of onefinejay.com