This is my personal blog. The views expressed on these pages are mine alone and not those of my employer.

Tuesday, September 20, 2005

AJAX History Libraries

I know of the the following AJAX libraries and techniques which address bookmarking and the back button in AJAX applications: Backbase, Dojo, Mike Stenhouse's "Fixing the Back Button and Enabling Bookmarking for AJAX Apps" article, Erik Arvidsson's Hash Listener library, and the Really Simple History framework I created recently. I will be fully describing the Really Simply History library in a forth-comming article from the O'Reilly Network.

The following major issues affect all of the AJAX history libraries I have evaluated, other than the Really Simple History framework.

First, some history frameworks, such as Dojo, use JavaScript objects to store an internal representation of the state of an AJAX application's history; unfortunately, browsers completely clear out all JavaScript objects when a user leaves a page. If a user interacts with an AJAX application, navigates to Google, and then returns to their original AJAX page, the AJAX history framework's internal state is erased and becomes confused.

Another bug that affects many frameworks is that they do not differentiate between the first time a page truly loads versus "fake" page loads. In many browsers, when a user first loads an AJAX application, the browser will throw an onload event. Later, if the user navigates to a different web site and then returns using the back button, the browser will throw a new onload event even though the page already loaded the first time. Many subtle bugs can occur in AJAX history frameworks unless these two kinds of load events are differentiated.

Finally, I have not seen an AJAX history framework that will detect when a user has manually entered a new hash location in Internet Explorer.

The Really Simple History framework, available here, uses several techniques to solve these bugs. The primary mechanism is achieved using DhtmlHistory, a JavaScript class that allows developers to store history state after the browser has left a web page. This data is persisted between page loads using the auto save capability of web forms; see my blog post "AJAX Tutorial: Saving Session Across Page Loads Without Cookies, On The Client Side" for implementation details. DhtmlHistory wraps the auto save trick with an easy hash table API for developers, and the main RSH framework then uses the DhtmlHistory class to implement stateless tracking of history; variables that allow the detection of fake versus real page load events; and more.

Eavesdrop on the Savannah

This is jawdroppingly amazing. It's a webcam that National Geographic has set up at an extremely active watering hole in the middle of Botswana. I've been tuning into it at regular intervals and seeing the most amazing things. Right now a family of elephants is hanging out at the watering hole; the sounds of thousands of birds flutter out of my computer monitor. Check it out (requires RealPlayer).

The technical details of how they managed to set up and link a webcam in one of the most remote parts of the earth are fascinating:

"Linking the live WildCam Africa Internet video camera from one of the most remote locations in southern Africa to a satellite hovering 22,500 miles (36,200 kilometers) above the Earth's equator was the easy part. The challenge was how to keep baboons from messing with the camera, prevent insects from slithering inside the computer, and protect the whole setup from curious elephants. National Geographic spent weeks looking for someone who had done it before. Trouble was, nobody had. But Cameron Murie came close enough. "

Read more on the technical details.

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]