Issue link: https://read.uberflip.com/i/1146286
98 | Chapter 14: Rule 14: Make Ajax Cacheable The technologies behind Ajax have been around much longer than the phrase itself. IFrames, first found in Internet Explorer 3 in 1996, allow asynchronous loading of content within a page, and are still used today in some Ajax applications. XMLHttpRequest, what I consider the heart of Ajax, was available in Internet Explorer 5 in 1999 (under the name XMLHTTP), and in Mozilla in 2002. The proposed W3C XMLHttpRequest specification for Ajax was first released in April 2006. I highly recommend using the Yahoo! UI (YUI) Connection Manager for Ajax devel- opment (http://developer.yahoo.com/yui/connection). It handles browser compatibil- ity issues with XMLHttpRequest and has excellent documentation and code samples. Asynchronous = Instantaneous? One of the cited benefits of Ajax is that it provides instantaneous feedback to the user because it requests information asynchronously from the backend web server. In the article referenced earlier, Jesse James Garrett uses Google Suggest and Google Maps as examples of web interfaces where "everything happens almost instantly." Be careful! Using Ajax is no guarantee that the user won't be twiddling his thumbs waiting for those "asynchronous JavaScript and XML" responses to return. I'd hate to use Google Maps and Yahoo! Maps on a dial-up connection. In many applica- tions, whether or not the user is kept waiting depends on how Ajax is used. Front- end engineers once again shoulder the responsibility of identifying and following the best practices required to ensure a fast user experience. A key factor to whether the user might be kept waiting is whether the Ajax requests are passive or active. Passive requests are made in anticipation of a future need. For example, in a web-based email client, a passive request might be used to download the user's address book before it's actually needed. By loading it passively, the client makes sure the address book is already in its cache when the user needs to address an email message. Active requests are made based on the user's current actions. An example is finding all the email messages that match the user's search criteria. The latter example illustrates that even though active Ajax requests are asynchro- nous, the user may still be kept waiting for the response. It is true that, thanks to Ajax, the user won't have to endure a complete page reload, and the UI is still responsive while the user waits. Nevertheless, the user is most likely sitting, waiting for the search results to be displayed before taking any further action. It's important to remember that "asynchronous" does not imply "instantaneous." I definitely agree with Jesse James Garrett's final FAQ. Q. Do Ajax applications always deliver a better experience than traditional web appli- cations? A. Not necessarily. Ajax gives interaction designers more flexibility. However, the more power we have, the more caution we must use in exercising it. We must be care- ful to use Ajax to enhance the user experience of our applications, not degrade it.

