Chapter 6. Controlling the Back Button

AJAX applications make asynchronous, out-of-band calls to the server, and typically update the page dynamically based on the data returned. The result is a seamless incremental update to the page without fully reloading it. However, while this mechanism enables some wonderful applications, it completely bypasses one of the browser features users are most familiar with — navigation history. Because the update to the page is done in the background and the page is not actually reloaded, the user is technically always on the same page. But if large changes are made to the page, they may not feel like it is the same page, and so would probably expect that clicking their browser's back button would take them to the previous state. Unfortunately, they are going to end up on whatever page they were on before first loading that page, which could even be another Web site.

It may seem that the back button is basically broken in AJAX applications, unless care is taken to restore it to normal operation. But actually, an AJAX application gains greater control over the navigation history than is possible with a traditional application! Using the tools you will learn about in this chapter, you will see how to take control over when the browser creates history points, making it possible to choose exactly which operations should get them, and which should not.

Get Professional ASP.NET 3.5 AJAX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.