Thursday, January 26th, 2006p>Backbase’s Mark Schiefelbein has produced a tutorial on handling the Back-Button with Ajax.
He notes that the well-cited top 10 Ajax applications includes many examples that break standard expectations about the web. “As a direct consequence of the changes in how to use (D)HTML and HTTP, Ajax applications break the back button and other elements of the Web’s fundamental interaction style.”.
- Create history
- Save meaningful state
- Generate a corresponding URI
- Push the URI onto the browser stack
The state I want to save is every change to the select box. Therefore I’ll create a new URI that includes the select box state information.
To remain compliant with Internet standards, I’ll use the fragment identifier part of the URI. As stated in the IETF RFC 3986, “…Fragment identifiers have a special role in information retrieval systems as the primary form of client-side indirect referencing, < ...> the fragment identifier is separated from the rest of the URI prior to a dereference, and thus the identifying information within the fragment itself is dereferenced solely by the user agent, regardless of the URI scheme….”
Using the fragment identifier, I can create an “Ajax-URI,” composed of a client-side and a server-side part, separated by the hash (“#”) sign.
According to the article, Backbase has builtin support for this trick. The framework takes into account subtleties too, such as the way IE ignores the fragment identifier when it comes to the back button (solved via IFrames). This Ajax forum demonstrates the technology.
Posted by Michael Mahemoff at 6:13 am