Hijax
Got back from Mobile Monday drunk, snoozed for an hour and now I’m learning new hacking tricks! I surely do have the strangest working hours. I have an excuse, Louise started a new job working nights this week, she finishes at four and will be back in an hour. I wanted to stay up and wait for her.
Anyway, Hijax is the combination of two very cool ideas: 1. Ajax, 2. Progressive enhancement. Progressive enhancement, advocated by Jeremy Keith, in his book DOM Scripting (which I do not own and have not read), suggests that whizzy JavaScript functionality should be automatically added to a simple HTML page after the fact. So instead of building an app with a bunch of links that call JS functions, I’d create a vanilla web app with links to new pages. Then I would write JS code that goes and finds those vanilla links and hijacks them, replacing them in the DOM with links to teh whizzy.
This idea doesn’t just relate to Ajax of course, but it provides a foundation for building higher-quality Ajax apps. As Mr Keith so eloquently puts it: “progressive enhancement automatically guarantees graceful degradation.” Because the old links are still there for non-JS users (old browsers, browsers with no JS, search engines, etc) my app still works perfectly well, if less whizzily.
This is the single coolest JS trick I’ve ever come across, way cooler than all that Ajax rubbish :-). Deployment of JS whizzitronics follows the same model as the deployment of CSS beauty. The underlying content is preserved, so you can have your cake and eat it too. I highly recommend reading Jeremy’s blog and the sample chapter as he explains this stuff much better than me in my tired, post-booze state.