PREVIOUS   NEXT   CONTENTS   HOME 

4.2 AJAX

Under the traditional paradigm for web sites and the internet, web pages are static entities that display a predetermined set of data. When a user requested a resource, the server served it up to the client. This synchronous request/response interaction often required the entire web page to be constantly refreshed in the browser even for the simplest of page updates. To break this model, scripting languages were used which add a dynamic element to web pages. Microsoft's Remote Scripting (MSRS) technology allows asynchronous page updates without the entire page refreshing. This is a very powerful tool in the web developer's arsenal but MSRS only works with Microsoft technologies and requires Java, which excludes many users and designers. A platform-neutral answer to the Microsoft version was JavaScript Remote Scripting (JSRS) developed by Brent Ashley. JSRS relies on a client-side JavaScript library and Dynamic HyperText Markup Language (DHTML) to make asynchronous calls to the server. Another method used by many developers was a hack that takes advantage of the IFRAME tag to hide portions of the page, which results in the appearance of asynchrony (Asleson and Schutta 2006, 12). None of these are ideal solutions to create dynamic web pages, however.

Ajax, on the other hand, is a powerful and tangible tool for web developers to create dynamic web pages. This technique works in most modern browsers and does not require proprietary software or hardware to run. Ajax takes existing technologies, which have been around and used by developers extensively, to perform new tricks (McLaughlin 2005). Many of the tricks that Ajax performs can be simulated through other less elegant methods, but they are not as simple and often require much more code. Ajax is also a client-side approach that works with .NET, PHP, Ruby, and other server-side scripts in a manner which Asleson and Schutta refer to as 'server agnostic' (2006). With Ajax the line between web and desktop applications becomes blurred because of its interactive and responsive behaviour. Ajax creates new opportunities for web application development because developers are no longer hindered by proprietary techniques and disappointing compromises (Asleson and Schutta 2006, 20).

The foundation of Ajax is built on the XMLHttpRequest object, which has been around since Internet Explorer (IE) 5 as an ActiveX control. XMLHttpRequest is the object that enables the sending of requests and the asynchronous processing of the server's response. Typically, the XMLHttpRequest object is invoked after being triggered by a client-side event, after which a request is made to the server. The XMLHttpRequest object does not actually make the request, only allows for the asynchronous communication between the server and client. Depending on the request, the server can then run a script, gather data, access another system, or perform a multitude of other functions. Once the server has finished its operation the response is sent to the browser. The web page is then updated without the need for the entire page to be refreshed. In this way, data stored in a database or XML file is easily accessed using Ajax.

The reason Ajax has had its sudden surge in popularity is because of the recent level of browser support the XMLHttpRequest object has received. Everything after IE 5, Mozilla 1.0, and Safari 1.2 has widespread support for the object and it is in the working draft stage to be a W3C standard (van Kesteren 2006). Even though it has not yet been ratified, the objects behaviour is similar in the current versions of Firefox, Safari, Opera, Konqueror, and IE.

4.3 Potential problems

One issue is that the requests made through the XMLHttpRequest method do not get stored in browser history. This may cause confusion for users who are accustomed to being able to sequentially back-step through pages and data. In addition, since content is created dynamically, reproducing an Ajax-created page using the URL is not possible. Also, since Ajax is dependent on JavaScript to run, potentially thousands of lines of JavaScript code can be running on a browser, which may be excessive. This can be corrected, however, by employing the intelligent use of JavaScript and good web design practices. Browser security can also cause problems if JavaScript is turned off, therefore preventing any functions from running. The browser's security 'sandbox' also imposes itself on the XMLHttpRequest object. This means that any resources requested by the XMLHttpRequest object must be in the same domain the script is in, preventing direct calls to other servers or domains. Communication between multiple domains and distributed servers is possible as long as the exchange is handled between the servers directly. Additionally an Ajax proxy or JavaScript Object Notation (JSON) can be used to avoid the Ajax same-origin policy (Yoshihama et al. 2007). The final issue with Ajax is that it is not yet a standard, although it is on track to be so and enjoys widespread browser support.


 PREVIOUS   NEXT   CONTENTS   HOME 

© Internet Archaeology/Author(s) URL: http://intarch.ac.uk/journal/issue23/5/4.2.html
Last updated: Tue Mar 25 2008