Fixing the Back Button and Enabling Bookmarking for AJAX Apps
I didn't post too much lately because I am quite busy on a challenging website using Ajax and .Net 1.1.
As I said before architecture is the key for a solid Ajax application, and one hot debate at the moment is about the handling of the refresh and back buttons.
In a real world (not the fancy techie one where everything is perfect!) I can't blame a user if he hit Refresh and all the data he has entered in aform suddenly disappear!
Remember Ajax name for most of the people on this planet is associated with detergent :-)
Yes some solutions exist, but too complicated for what I need and the one I notice is based on an Ajax framework (see the demo here) and I prefer not to bloat my pages with a big chunk of Javascript just for that.
Anyone here has found a right way? I did some experiments with Google Ajax applications and most of them have the same issues. So unless I find something, my Ajax code will be limited to some basic features and through iframes.
I dare to blame the browsers developers on that (Internet Explorer 7 and for Firefox 2.0). After all we're talking about Ajax since 2 to 3 years so I don't understand why when Microsoft or the Mozilla foundation develop a new browser they can't address this issue by a clever standard implementation.
I think they missed a big opportunity to create a true Web 2.0 platform.
Now maybe we have to wait for IE 8 and Firefox 3?
UPDATE 1: This post on Isolani give an interesting point of view on the subject.
Abstract:
Is AJAX a web document or a web application?
Part of the AJAX problem is understanding whether an AJAX enhanced page is actually a web application, or is it still just a web document? I'm inclined to agree with Jeremy Keith, in his blog post Hijax, where he opines: Web applications and web pages are not mutually exclusive. One is built on top of the other.
Web applications have been around before AJAX was christened. Even before Microsoft invented XmlHttpRequest. Outlook Web Access before XmlHttpRequest used frames - and ran into a number of usability and accessibility issues.
...
Fixing the browser history object
Solving the addressability issue goes a long way to solving the navigation and bookmarking issues of an AJAX document. But its not a complete solution. Browser vendors need to update their browsers so that JavaScript can modify the history object of a browser.
When JavaScript modifies a document, it should be able to add a new item to the browsers history, and store the current document in the browser's cache (storing the state of the current document). At this point, two documents are available - the starting document, and the document after JavaScript has modified it. The URLs used to store these documents in the browser cache should be valid enough that if the cache is cleared, then requesting the URL should still be able to retrieve the document by one of the three methods outlined above.
There's a number of security issues arising from opening up the history object in this way. These need to be carefully weighed to prevent malicious use.
UPDATE 2: On OReilly site I forgot to mention a potential contender for a solution. Check also this step by step implementation of the Really Simple History javascript library.