Develop AJAX applications that retain standard browser capabilities (2)

Source: Internet
Author: User
Tags error handling html form
ajax| Standard | program | browser basic design ideas for backing back buttons in Ajax

In this section, we will discuss the basic steps needed to support the back button in an AJAX application and give a simple sample code that describes the steps required.

The simple example program, shown in Figure 1, will have a selection box in the interface that has two values: "Year 1" and "Year 2". For this program, we will track the history when the selection box value changes. This means that the user can first select Year 2 and then click the Back button to go back to the previous selection.


Figure 1. A simple sample program with a selection box

The sample program was originally a simple HTML form with JavaScript getter and setter (for selecting a box value): 



We will first implement the first requirement: Create a history of the state. As we mentioned earlier, this requirement consists of the following three steps:


Create history

Save a meaningful state

Generate the appropriate URI

Add this URI to the browser's stack

We want to be able to save every change in the selection box. So we'll create a new URI that contains the state information for the selection box.


To conform to Internet standards, we will use the fragment identifier portion of the URI. In accordance with the terms of the IETF RFC 3986, "... As the main form of indirect client references, the fragment identifier plays a special role in the information retrieval system, and the 〈......〉 fragment identifier is detached from the rest of the URI before the reference is lifted, so the identity information in the fragment itself is discarded by the user agent, regardless of the URI scheme ... ".


Ajax: A new way to build Web apps

Discussion on the error handling mechanism of AJAX (2)

Discussion on the error handling mechanism of AJAX (1)

First experience. NET Ajax Brushless New technology

A brief analysis of Ajax development Technology in Rails system (4)





Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.