Benefits and disadvantages of using AJAX

Posted by mady | Posted in | Posted on 8:46 PM

 

 Benefits of using AJAX:

Bandwidth utilization

By generating the HTML locally within the browser, and only bringing down JavaScript calls and the actual data, Ajax web pages can appear to load relatively quickly since the payload coming down is much smaller in size. An example of this technique is a large result set where multiple pages of data exist. With Ajax, the HTML of the page, e.g., a table control and related TD and TR tags can be produced locally in the browser and not brought down with the first page of the document.

In addition to "load on demand" of contents, some web based applications load stubs of event handlers and then load the functions on the fly. This technique significantly cuts down the bandwidth consumption for web applications that have complex logic and functionality.

User interface

The most obvious reason for using Ajax is an improvement to the user experience. Pages using Ajax behave more like a standalone application than a typical web page. Clicking on links that cause the entire page to refresh feels like a "heavy" operation. With Ajax, the page often can be updated dynamically, allowing a faster response to the user's interaction. While the full potential of Ajax has yet to be determined, some believe it will prove to be an important technology, helping making the web even more interactive and popular than it currently is.

Separation of Data, Format, Style, and Function

A less specific benefit of the AJAX approach is that it tends to encourage programmers to clearly separate the methods and formats used for the different aspects of information delivery via the web. Although AJAX can appear to be a jumble of languages and techniques, and programmers are free to adopt and adapt whatever works for them, they are generally propelled by the development motif itself to adopt separation between:

(1) The raw data or content to be delivered - which is normally embedded in XML and sometimes derived from a server-side database.

(2) The format or structure of the webpage - which is almost always built in HTML (or better, XHTML) and is then reflected and made available to dynamic manipulation in the DOM

(3) The style elements of the webpage - everything from fonts to picture placement - are derived by reference to embedded or referenced CSS; and

(4) The functionality of the web page is provided by a combination of

(A) Javascript on the client browser (also called DHTML),

(B) Standard HTTP and XMLHttp for client-to-server communication, and

(C) server-side scripting and/or programs utilizing any suitable language preferred by the programmer to receive the client's specific requests and respond appropriately.

  Disadvantages of AJAX:

Browser integration

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.

Developers have implemented various solutions to this problem. These solutions can involve using invisible IFRAMEs to invoke changes that populate the history used by a browser's back button. Google Maps, for example, performs searches in an invisible IFRAME and then pulls results back into an element on the visible web page.

Another issue is that dynamic web page updates make it difficult for a user to bookmark a particular state of the application. Solutions to this problem exist, many of which use the URL fragment identifier (the portion of a URL after the '#') 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, however, not 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, smart preloading of data and proper handling of the XMLHttpRequest object, users might experience delay in the interface of the web application, something which users 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. The 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.

In general the potential impact of latency has not been "solved" by any of the open source Ajax toolkits and frameworks available today, such as the effect of latency variance over time.

Search Engine Optimization

Websites that use Ajax to load data which should be indexed by search engines must be careful to provide equivalent data at a public, linked URL and in a format that the search engine can read, as search engines do not generally execute the JavaScript code required for Ajax functionality. This problem is not specific to Ajax, as the same issue occurs with sites that provide dynamic data as a full-page refresh in response to, eg, a form submit (the general problem is sometimes called the hidden web).

Javascript reliability

Ajax relies on Javascript, which may be 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 not uncommon to see a Javascript code written twice, a part for IE, a part for Mozilla compatibles.

Comments (2)

Not only is this a well-written post, but I love the topic. Really trustworthy blog. Thanks for sharing !

Thank you for describing in detail about merits and demerits about Ajax. It is a valuable tool.
Digital Signature Mart

Post a Comment