Summary
In an ideal world, all visitors to our web site would have the latest release of the best browser available on the market, being ready to enjoy our AJAX applications, which usually require JavaScript, the XMLHttpRequest object (or something equivalent), decent support of Document Object Model (DOM), and Cascading Style Sheets (CSS).
Unfortunately, we usually have to cope with a wide range of visitors who cannot execute the truly interactive code we’ve deployed, either because they have decided to disable JavaScript or because they understand only about HTML markup (as search engine spiders do).
In some cases, you might decide that the few visitors who can’t execute your AJAX applications are not worth caring about. Sometimes, you don’t care about search engine spiders, particularly if the access to your application is password-protected (example: Gmail). In a majority of scenarios, however, you still have to give HTML-only visitors at least some limited functionality.
You’ll get the best results in AJAX-and-HTML application development if you follow the principles of HIJAX: Plan for AJAX from the start and implement it at the end.
Ideally, you would develop your application in the following major steps:
- Develop individual server-side transactions that return XML data.
- Use XSLT transformations on the server to convert the XML data into HTML pages served to non-AJAX-capable visitors.
- Develop client-side AJAX code that will use the transactions developed in the first step and display the resulting data in dynamic, interactive format.
If you’re willing to ignore fringe browsers that don’t support XSLT, you could even reuse the XSLT transformations developed in the previous step to transform the XML data into HTML markup on the client.