Understanding the disadvantages of using AJAX
Friday, April 25, 2008
Though Ajax delivers more responsive user interface and uses less band width over internet, understanding the disadvantages of using AJAX will help us to design better web applications.
The dynamically created page does not register itself with the browser history engine, so triggering the "Back" function of the users' browser might not bring the desired result.
Possible Solution
Using invisible IFRAMEs to invoke changes that populate the history used by a browser's back button.
Example: Google Maps - performs searches in an invisible IFRAME and then pulls results back into an element on the visible web page.
Dynamic web page updates make it difficult for a user to bookmark a particular state of the application.
Possible Solution
Use the URL fragment identifier to keep track of, and allow users to return to, the application in a given state. This is possible because many browsers allow JavaScript to update the fragment identifier of the URL dynamically, so that Ajax applications can maintain it as the user changes the application's state.
This solution also improves back-button support. It is not, however, a complete solution.
Response-time concerns
Network latency — or the interval between user request and server response — needs to be considered carefully during Ajax development. Without clear feedback to the user, preloading of data and proper handling of the XMLHttpRequest object, users might experience delays in the interface of the web application, something which they might not expect or understand. Additionally, when an entire page is rendered there is a brief moment of re-adjustment for the eye when the content changes. The lack of this re-adjustment with smaller portions of the screen changing makes the latency more apparent.
Possible Solution
Use of visual feedback (such as throbbers) to alert the user of background activity and/or preloading of content and data are often suggested solutions to these latency issues.
Search engine optimization
Websites that use Ajax to load data which should be indexed by search engines must be careful to provide equivalent Sitemaps data at a public, linked URL that the search engine can read, as search engines do not generally execute the JavaScript code required for Ajax functionality.
Reliance on JavaScript and the DOM
Ajax relies on JavaScript and the browser's Document Object Model (DOM), which are often implemented differently by different browsers or versions of a particular browser. Because of this, sites that use JavaScript may need to be tested in multiple browsers to check for compatibility issues. It's common to see JavaScript code written twice, one part for IE, another part for Mozilla compatibles, although this is less true with the release of IE7 and with the now-common use of JavaScript abstraction libraries like the Prototype JavaScript Framework or Jquery. Such libraries abstract browser-specific differences from the web developer.
Web analytics
Many web analytics solutions are based on the paradigm of a new page being loaded whenever new or updated content is displayed to the user, or to track a series of steps in a process such as a check-out. Since Ajax alters this process, care must be taken to account for how to instrument a page or a portion of a page so that it can be accurately tracked.
Possible Solution
Analytics systems which allow for the tracking of events other than a simple page view, such as the click of a button or link, are the ones most likely to be able to accommodate a site which heavily utilizes Ajax.