Traditional WEB applications can be very good at supporting the browser's bookmark collection as well as the forward back button. In Ajax-based WEB applications, the content of the page refresh is often through asynchronous request in the way of dynamic local refresh, and will not request a page, so the page corresponding URL does not change, the forward back button will not play any role. This leads to the inability of bookmarks to record specific views in such Ajax applications. In this paper, we will first introduce the universal programming model of the bookmarking Ajax application based on hyperlink anchor, and then combine the analysis and design of the programming pattern and illustrate how to apply the Dojo.back technology provided by Dojo to realize the bookmarking Ajax application. Finally, the new Dojo.hash technology provided in the next Dojo1.4 can be introduced to support the application of bookmarking Ajax. By reading this article, readers can learn how to design a bookmarking Ajax application based on the hyperlink anchor, and enable bookmarking Ajax applications with Dojo.back technology provided by Dojo or Dojo.hash technology.
The challenge of bookmarking Ajax applications
Ajax technology brings a whole new experience to web users, as well as a variety of challenges for web developers. For the browser bookmark collection and the Forward Back button support, is one.
For traditional WEB applications, it's natural for browsers to bookmark favorites and signature back buttons, and developers don't need to do extra work. Each WEB page has a unique URL, the bookmark URL corresponds to the corresponding page, and the user will be browsing between different pages to form a history queue, each item in the queue corresponding to a page (URL), the browser by recording this historical queue to provide the forward back button function.
But in Ajax-based WEB applications, things are different. Most of the time the page view is converted by the asynchronous request dynamically local refresh page implementation, and did not request a new page, so the page view of the corresponding URL will not change, and will not form the historical records mentioned above. Today's browsers also support bookmark collection and forward back buttons in a traditional Web application. For emerging Ajax WEB applications, browsers are not very supportive in this regard. This leads to a bookmark collection of browsers, and the Forward Back button function loses its meaning for Ajax Web applications.
Figure 1. Differences between traditional Web applications and Ajax Web applications
Is that the only way we can give up bookmark collection and forward back functionality in our existing browsers? Obviously this is very difficult to accept, so that the user will be brought to use the experience of the promotion of Ajax technology to lose a good user experience. Luckily we still have a way. Next, we will introduce a technology based on hyperlink anchor to achieve browser bookmark collection and forward Back button support for Ajax WEB applications. For simplicity, AJAX applications that support browser bookmark collection and forward back functionality are referred to as bookmarking AJAX applications.