Ajax traps (Ajax Gotchas)
Ajax trap
Ajax is an awesome technology that is driving a new generation of web apps, from maps.google.com to colr.org to backpackit.com. But Ajax is also a dangerous technology for web developers, its power introduces a huge amount of UI problems as well as server side state problems and server load problems.
Ajax is an important technology, it will lead the next generation of web application development trend, then backpackit.com colr.org to maps.google.com, is full of the ajax Qingying. But for web developers, the ajax is a dangerous technology, it has also led to the strength of a lot of UI issues, such as the issue of server-side and server load problems.
I've compiled a list of the many mistakes developers using Ajax often make. Javascript itself is a dangerous UI technology, but I've tried to keep the list to problems particular to Ajax development:
I edit a ajax developers in the use of the mistakes committed during the regular list. Javascript itself is a dangerous UI technology, but I still make as much as possible the list contains only ajax encountered in the development of the problem, and remove swap Javascript itself.
Mistakes:
Error:
Not giving immediate visual cues for clicking widgets. If something I'm clicking on is triggering Ajax actions, you have to give me a visual cue that something is going on. An example of this is GMail loading button that is in the top right. Whenever I do something in GMail, a little red box in the top right indicates that the page is loading, to make up for the fact that Ajax doesn't trigger the normal web UI for new page loading.
Click Control is not promptly after the visual messages. If I click on this thing ajax triggered an action, then you have to give me a visual reminder, I told some action is being implemented. One example is the upper right hand corner of Gmail pages loaded button (loading button). No matter when, when I Gmail operation in the implementation of any page on the upper right hand corner of the red button I will be tips, pages are loading. This obvious to the user Note that your actions, thereby overcoming ajax no longer override the user pages and I do not know whether the operation of the inconvenience.
Coofucoo say:
Habits can be cultured. Just as users used to use windows, which will be used to the "Start" button, though the beginning they will ask: "Why I would like to shut down, but also from the 'Start' began?." When the majority of web pages users are accustomed refresh means that the data are submitted to the traditional concept, once you break this concept, you must be careful, as many prompts the user to your current operation, the user does not feel bewildered, "in the end that the procedures in this damned doing ??!!"。 Negative examples you can find Qiuqiu the blog.
Breaking the back button The back button is a great feature of standard web site user interfaces. Unfortunately, the back button doesn't mesh very well with Javascript. Keeping back button functionality is a major reason not to go with a pure Javascript web app.
Coofucoo say:
This is Yingshang seems to be no solution. I think the current solution is in their own procedures, to provide a back button, and to replace the browser button. But I am afraid that this will increase the workload.
Undermine back button functions. Back button web user interface standards, a very important function. But unfortunately, the back button combination of function and Javascript is not good. Keep back button function is we do not use pure Javascript web applications reasons.
Changing state with links (GET requests) As I've referenced in a previous posting, Ajax applications introduce lots of problems for users who assume GET operations don't change state. Not only do state changing links cause problems for robots, users who are accustomed to having links drive navigation can become confused when links are used to drive application state changes.
Links to convert even with the state? (GET send requests), as I mentioned earlier, some believe that the operation will not change GET state users, the ajax applications led to a lot of problems. Can change the status of those links not only lead to the use of web applications habits change, which makes it easy to think that the habit of navigation links is the most use from the users feel very confused.
Coofucoo say:
Feeling of this place a bit difficult to understand, explain. Hyperlinks to the most primitive function is to switch between pages, you click on a page from a hyperlink, will be taken to another place. After hyperlinks to develop, GET method can be used to send some data server, but some users still think that is the function of hyperlinks from the role of navigation. But now the situation has changed, ajax, due to the large scale introduction of Javascript, so an ordinary hyperlinks can also play the original button can play a role, such as in the asp.net linkbutton. This may be more powerful, but has given some of the habits and users about the changes, the problem will be introduced.
Blinking and changing parts of the page unexpectedly The first A in Ajax stands for asynchronous. The problem with asynchronous messages is that they can be quite confusing when they are pop in unexpectedly. Asynchronous page changes should only ever occur in narrowly defined places and should be used judiciously, flashing and blinking in messages in areas I don't want to concentrate on harkens back to days of the html blink tag.
Pages may be a part of a surprisingly, the Yizhawen to change. Ajax this group of acronyms in the first letter "A" on behalf of "asynchronous (asynchronous)." Induction of the problems brought about by the information that they will be quietly implementation, there is no sign of a sudden pop up, people feel very confused. Asynchronous pages of the changes should be carefully designed, made it clear that the wise use, suggesting that the information should be placed in those places I will not concentrate, and use this technology such as blink marking his flashing up.
Not using links I can pass to friends or bookmark Another great feature of websites is that I can pass URLs to other people and they can see the same thing that I'm seeing. I can also bookmark an index into my site navigation and come back to it later. Javascript, and thus Ajax applications, and can cause huge problems for this model of use. Since the Javascript is dynamically generating the page instead of the server, the URL is cut out of the loop and can no longer be used as an index into navigation. This is a very unfortunate feature to lose, many Ajax webapps thoughtfully include specially constructed permalinks for this exact reason.
Hyperlinks become meaningless, it can not transfer to a friend or collection. Another important function of the web site is a URL you can be transmitted to another person, and he will see you through this URL to see things. Of course, I can also put the URL of my favorites, so I visited him after. Javascript, including Javascript based on the ajax application of this technology will bring enormous challenge mode. Since Javascript replaced the server, used to produce dynamic data, not the specific URL on behalf of the entire interactive cycle of a state, it can no longer holds. This aspect of the loss is very regrettable that many ajax web applications in this regard to consider very carefully, including specialized construct a special link (permalinks) to deal with such a situation.
Too much code makes the browser slow Ajax introduces a way to make much more interesting javascript applications, unfortunately interesting often means more code running. More code running means more work for the browser, which means that for some javascript intensive websites, especially poorly coded ones , you need to have a powerful CPU to keep the functionality zippy. The CPU problem has actually been a limit on javascript functionality in the past, and just because computers have gotten faster doesn't mean the problem has disappeared.
Too much of the code for the browser has become slow. Ajax brought a very interesting javascript application, but, unfortunately, it means more interesting code at runtime. More code means that the browser do more work, in particular some bad code While strengthening the function, but you need to have a robust CPU to support the realization of these functions. CPU is actually strong enough restrictions javascript function in the past an important factor, and even if the current computer has become more and more rapidly, the problem has not completely disappeared.
Inventing new UI conventions A major mistake that is easy to make with Ajax is: 'click on this non obvious thing to drive this other non obvious result'. Sure, users who use an application for a while may learn that if you click and hold down the mouse on this div that you can then drag it and permanently move it to this other place, but since that's not in the common user experience, you increase the time and difficulty of learning your application, which is a major negative for any application .
UI used to create new habits. Use ajax very easy to be wrong: "granted the request of users click on a hidden things, and then a visible results back to the local user." Indeed, when a user of your procedures for a period of time, he can understand, if he will be in a mouse click on the region, and to maintain the state of press drag on this region can be moved to another permanent location. But these experiences are not born each user will know, if you do this, then you for your users learn how to use your application to increase the difficulty and time, and this is the case for most applications, are extremely the negative impact.
Not cascading local changes to other parts of the page Since Ajax / Javascript gives you such specific control over page content, it's easy to get too focused on a single area of content and miss the overall integrated picture. An example of this is the Backpackit title . If you change a Backpackit page title, they immediately replace the title, they even remember to replace the title on the right, but they don't replace the head title tag with the new page title. With Ajax you have to think about the whole picture even with localized changes.
When local changes, may need some other pages, manifested synchronization. From Ajax / Javascript gives you control (change) the specific content pages, are particularly vulnerable committed only partial data on changes in the entire page and forget the synchronous changes mistake. One example is the Backpackit (www.backpackit.com) title. If you implemented a change Backpackit pages action, the title will be immediately reversed, or even the right of the heading will be a change, but they forget that for a new page in synchronization <head> labels in the <title> marker. In ajax, when you change local, you need to consider the whole page synchronization.
Asynchronously performing batch operations Sure with Ajax you can make edits to a lot of form fields happen immediately, but that can cause a lot of problems. For example if I check off a lot of check boxes that are each sent asynchronously to the server, I lose my ability to keep track of the overall state of checkbox changes and the flood of checkbox change indications will be annoying and disconcerting.
Asynchronous operation batches implementation of the problems brought about. Indeed, in ajax, you can edit many different forms, and the timely submission of the form will be, but it has also brought a lot of problems. For example, I edited some of some box, each individual can be asynchronous data will be submitted to the server, but at the same time I lost in the overall state control of the capacity of these boxes, and each box to the and then returned to the results of the information that will become very unpleasant.
Scrolling the page and making me lose my place Another problem with popping text into a running page is that it can effect the page scroll. I may be happily reading an article or paging through a long list, and an asynchronous javascript request will decide to cut out a paragraph way above where I'm reading, cutting my reading flow off. This is obviously annoying and it wastes my time trying to figure out my place.
Another problem is that immediately to a running into the content pages could lead to rolling pages. I might like to read a full article indicated, although the article may be very long. But an asynchronous javascript procedures Perhaps I will read the part of the loss to affect my reading. When I try to read before I again find the location, such a mechanism would be particularly inconvenient.
In addition, some programming issues:
Furthermore, there is some programming issues:
Be careful about what you expose on the server, especially if you're using remote-stub frameworks like SAJAX. You can't necessarily let Javascript use generic services that you might let a server-side script call. Don't rely on a global XMLHttpRequest object. See Call Tracking.
Coofucoo say:
I did not translate this place out of the situation that he described was not very precise. Which know what was coming notice.
Be careful about changing the DOM in one call, such that when a later call returns, it ends up writing a value into the wrong DOM object - or perhaps the DOM object doesn't return at all (To be added to [Call Tracking ).
When you respond to a call to change the contents of DOM, we must be careful at this time of a later call to return, is likely to result in the wrong data into the DOM object, or might lead to the operation of the DOM object is not return.
Consider the effects of a call never returning. You can establish a timeout mechanism by setting a timer as soon as the call is made (with Javascript's ontimeout function). The timer can explicitly call the request's abort () method if no return has occurred, and inform the user accordingly.
Consider the situation did not return calls. You can call the function after the establishment of a timer (in the ontimeout Javascript function) to the establishment of a mechanism for overtime. If there is no return, this timer can be clearly implementation abort () (termination of operation), and notify the user.
Consider the effects of a call returning with an error status - perhaps alert the user somehow. A pattern like Synchronisation Status helps here, to alert the user that some data is stale.
Consider calling a mistake to return to the state, such a situation may prompt the user some baffling information. Synchronisation Status like this can be a model for us here to help, some data have been warning users of the problem.
Retrieved from "http://www.ajaxpatterns.org/Ajax_Gotchas"
Address quote: "http://www.ajaxpatterns.org/Ajax_Gotchas"
Tags: java ajax






