Damn. Sometimes people come around and do something really innovative that you should’ve already done yourself, you know? (What a haughty thought that is, huh?)
This OnJava article about adding history support to AJAX apps is one of these things. The idea is pretty simple, use hashes to keep track of what you’ve done and where you’ve been (there’s of course some serious considerations for most scripts–if you create something, you need to make sure you don’t recreate it and so forth for destroying).
A while back, I wrote this page to handle pagination issues (and come to think of it, this is sorta inspiring for a WP plugin…). Anyhoo, that page demonstrates the same principle of using hashes to respect browser history states.
Essentially you take advantage of JavaScript’s ability to parse the incoming request’s location.hash to determine which events should be played out.
I’ll save Lizzy the time and just yell nerd right now: Nerd!
One Response to AJAX plus history