AJAX - The Complete Reference

(avery) #1

472 Part II: Developing an Ajax Library^


Finally, the user backs up twice and heads back to the initial state. Since the library sees
no hash value in the URL, it calls the global history callback that was specified in the init().
This function, updateState(), seeing that there is no value, removes all the contents from
the file list so it looks just as it did when the user entered the viewer for the first time.

The process of using the photo viewer with the back button from the user’s perspective
works as the user would expect any site to work, except the odd hash-marked URLs, and is
shown in Figure 9-13. You should try the example for yourself to see if you think this effort
is worth the trouble.
During the user’s exploration of our photos, they might have come across pages they
wanted to bookmark or even send to a friend. We address such concerns next.

FIGURE 9-13 Back button enabled in Ajax photo viewer
Free download pdf