For my Mint project, I have been asked to capture the back button and simulate browser history for AJAX GET requests. We do a lot of AJAX magic on the site that looks to the average web user as if the page has reloaded, such as requests to: sort, search, filter, and paginate bank transactions. The product/marketing teams expect instant, desktop-like response (hence the AJAX), but they expect the browser to behave as a traditional browser does. And so the nightmare begins…
After spending the last week examining possible techniques for capturing the back, I have decided to use an approach that implements an IFRAME to queue browser history, and the "window.location.hash" value to store and allow dynamic history positions. YUI History uses this approach and I believe GWT does as well. However, I do not know GWT very well and it took me several hours to get the YUI History manager to work (and that was before doing anything with AJAX). In the end I decided to choose this light-weight package, Really Simple History, which was so easy that I had their demo working in under 30 minutes.
I have now spent several hours working with this and package and here are some :
- super easy to setup
- lightweight and standalone
- fairly easy to understand
- works well in firefox, IE, and opera
- when calling updateUI, if historyData is not null, I always get a too much recursion error
- doesn&rsquot;t support safari
That said, after refactoring the library to use YUI and the module pattern, I was able to shrink the size even further and have it mostly working in IE 6 & 7. I will continue working on it this week and hopefully will be able to write a working demo by Friday, supporting all listed browsers and Safari.