Chapter 10. AJAX and Browser History

After completing this chapter, you will

  • Understand the importance of navigational history and Back button support.

  • Understand the Microsoft AJAX Library’s support for history using Sys.Application.

  • Be able to implement history in your AJAX application.

  • Be able to support the Back and Forward buttons in the Web browser.

In the last few chapters we’ve examined the Microsoft AJAX Library in depth, along with its support for components, behaviors, controls, and rendering. Throughout the book, you’ve seen how to implement an AJAX application from the ground up using Web services for application functionality. As page-based navigation has been replaced with AJAX navigation, the overall usability of the Web application has increased, but the navigational usability of the Web application has decreased. In this chapter we’ll look at navigation and history support that lets users navigate in an AJAX Web application with ease.

The History Problem

In traditional Web applications, the URL of the page identifies its content, which is static for the lifetime of the page instance. After the page is loaded, either a form post (a postback) or a refresh is required to get new data. The Web browser remembers these actions in its history, and a user can navigate backward and forward.

When you remove URL-based navigation, replace it with JavaScript navigation, and load data on demand from the client rather than on page loading, you lose support for browser history. Worse, users still expect history support, which means that when they click the Back button in the browser, they expect to go back to the previously loaded context rather than the page they were viewing before logging on to your application.

Consider this scenario: A user opens her Web browser and sees her home page. Then she enters the URL of your application, logs on, and navigates around. After several minutes of activity, browsing and creating content, the user clicks the Back button expecting to go to the previous page of data. But because you implemented your application as one physical page with an AJAX data model, the user navigates back to her home page. It’s now difficult and confusing for that user to navigate to the context she was looking for and expecting.

Tip

Tip

Supporting browser history and navigation adds a tremendous amount of usability and polish to your AJAX application.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset