The disadvantages of ajax are: 1. It may destroy the browser's back and add bookmark functions; 2. The interval between the user's request and the server's response becomes longer, etc.
The operating environment of this article: Windows7 system, javascript1.8.5, DELL G3 computer
What are the disadvantages of ajax?
The main disadvantage of Ajax:
It may destroy the browser's back and add bookmark functions. In the case of dynamically updated pages, the user cannot go back to the previous page state because the browser can only remember static pages in the history. The possible differences between a page that has been completely read and a page that has been dynamically modified are very subtle; users often expect to click the back button to cancel their previous operation, but in an Ajax application, this is not the case. Unable to do so.
However, developers have come up with various ways to solve this problem. Most of the methods before HTML5 were to create or use a hidden IFRAME to reproduce the page when the user clicks the back button to access the history. changes. (For example, when the user clicks back in Google Maps, it searches in a hidden IFRAME and then reflects the search results onto an Ajax element to restore the application state to what it was at that time).
Regarding the problem of not being able to add status to favorites or bookmarks, one way before HTML5 was to use URL fragment identifiers (often called anchors, the part after the # in the URL) to keep track of, allowing The user returns to a specified application state. (Many browsers allow JavaScript to dynamically update anchors, which allows Ajax applications to update anchors while updating the displayed content.) HTML5 will later be able to directly manipulate browsing history, store web page status as a string, and add web pages to web favorites. When clipping or bookmarking, the state is retained invisibly.
The above two methods can also solve the problem of being unable to go back at the same time.
When developing Ajax, network latency—that is, the interval between the user's request and the server's response—needs to be carefully considered. Not giving users a clear response, not properly pre-reading data, or improperly handling XMLHttpRequest will make users feel bored.
The usual solution is to use a visual component to tell the user that the system is performing background operations and is reading data and content.
Of course, using Ajax also has the biggest advantage:
It is the ability to maintain data without updating the entire page. This allows web applications to respond more quickly to user actions and avoids sending unchanged information over the network.
Ajax does not require any browser plug-ins, but requires the user to allow JavaScript to execute on the browser. Just like DHTML applications, Ajax applications must be rigorously tested on many different browsers and platforms. As Ajax matures, some program libraries that simplify the use of Ajax have also come out. Likewise, another assistive programming technology has emerged to provide alternative functionality for users who do not support JavaScript.
Recommended learning: "AJAX Video Tutorial"
The above is the detailed content of What are the disadvantages of ajax. For more information, please follow other related articles on the PHP Chinese website!