The Basis For Xanjax


Brief Description of Xanjax

Xanjax is a client side AJAX framework, with full support for traditional Internet browser navigation and history. By enabling AJAX with navigational support, and by leveraging this capability with support for XML/XHTML to HTML conversion, Contextual Content Support and Progressive Enhancement, Xanjax makes AJAX feasible for entire website content delivery.

Knowledge or use of a server side language or framework is not essential since Xanjax can work fully client side. POST requests and JSON are supported however, along with PHP Server Pushlets, so server side technology integrates well with Xanjax when required. Note that JSON can be used in Xanjax without server side technology, and can be used to create CMS like 'contexts' - ie dynamic menus, links, lists or advertisements, which associate with main content on the basis of a template file.


XHR/AJAX Navigation Issues

Traditional browser navigational behaviour is highly intuitive. After giving an initial address, links and back/forward buttons are simply clicked to get around. This highly desirable navigational behaviour, along with bookmarking, was without a doubt pivotal in bringing the Internet to ordinary people. Even untrained, most anyone can access the Internet simply by clicking, while bookmarking for future reference along the way.

Although AJAX technology offered a broad promise of greater responsiveness and interactivity, web sites prior to Xanjax have mostly been narrowly focussed on improving interactivity of limited types of content. While this has led to some very useful and interesting 'Web 2' innovations, comprehensive website wide attempts at AJAX content delivery have mostly so seriously broken traditional browser navigation that this broader application of AJAX has generally been avioded.


Standard Browser Behaviour

Unfortunately, traditional web technology initiates complete page re-rendering for every link activation; regardless of whether new page content is mostly similar to any previous content or not. Regardless of size or significance of content, the most minor delays affect page rendering, causing transitional gapping, irregular whitespace and/or layout problems. Not only is this visually ugly, but much worse, the browser often becomes totally unresponsive during parts of its download phase, freezing scrollbars and not responding to back, or even stop commands.

This has led in part to the pun 'world wide wait,' on the acronym 'www.' The situation is exacerbated of course by the hunger for bandwidth chewing rich graphic content, which seems to readily outpace and outspace widespread broadband adoption and speed improvement. Additionally, no matter how fast the connection speed to an Internet backbone, the full connection path is nevertheless a serial connection passing through many nodes between browser and web server. Effective bandwidth is always limited to the speed of the slowest node in the route. Anything along the way, for example server overload, link overload, porn filters, virus filters, or workstation overload, can and quite often does slow a connection to a crawl, often to less than dialup speeds.

Significantly, modern Internet browsers still basically operate the same way, the only real offsetting improvements in this regard being smarter content caching linked with smarter display refreshing. Faced with network link delays as described above, today's browsers still suffer from exactly the same problems of stalling and visual ugliness. Surely we could use AJAX techniques to improve things on a huge scale!


AJAX Promises

A specific AJAX supporting technology, XMLHttpRequest or XHR, built into most modern Internet browsers has led some web designers to salivate in contemplation. Combining XHR with Javascript and Document Object Model (DOM) technologies makes it technically possible to update any portion of a page without the browser doing either a full page reload, or having any possibility of stalling.

The term AJAX (Asynchronous Javasript And XML), has been coined to signify the combination of XHR, Javascript and DOM technologies; either in partial page rendering or other browser/web server interaction. Often used synonomously with the term 'Web 2,' AJAX more accurately applies to the technical means behind enhanced browser communications and content interactivity, whereas 'Web 2' more correctly refers to the actual implementation of advanced Web based applications which depend on the enhanced behaviour made possible by the AJAX layer. Use of AJAX in and of itself doesn't necessarily consitute a 'Web 2' application; AJAX is often used in much more mundane ways, such as form submission.


AJAX Limitations

XMLHttpRequest is arguably one of the really positive Microsoft contributions to Internet browser technology. However, continued non-compliance with many World Wide Web Consortium (W3C) recommendations has lead to strong criticism of Microsoft. This is especially so among responsible web designers struggling to create cross browser W3C compliant content, who suffer huge costs and lost time daily for no other reason than Microsoft's historic stubborn resistance to full adoption of W3C recommendations. Importantly, the very lack of comprensive W3C DOM compatibility in Microsoft's browsers hugely inhibits practical solutions, in spite of their quite useful contribution of XMLHttpRequest.

Unfortunately, other significant difficulties also exist. XHR wasn't designed as a specific solution to traditional browser shortcomings, really being intended for incidental asynchronous communications with a web server, for form verification and submission or other similar purposes. As a result, XHR is totally void of any browser navigational support.

Browser navigation, history and bookmarking issues, together with excessive cross browser design difficulties in using the DOM (the latter mostly due to Microsoft's patchy adoption of W3C recommendations), have beset almost all attempts at broader website solutions using AJAX. Largely, the alleviation of traditional browser rendering ugliness, tardiness and non-responsiveness has been an unfulfilled dream.

Today, although AJAX is widely used for partial page updates that don't require traditional browser navigation, such as inclusion of advertisements or other dynamic content, and for so called 'Web 2' applications, such as Google Maps or Yahoo Mail, there are very few web sites using AJAX as a total solution (perhaps xanjax.org is the first). Typically today, AJAX techniques are used for content enhancement; rarely for general content delivery.

Many 'Web 2' applications require (or would at least greatly benefit from) traditional browser navigation. Often, navigation is left out of 'Web 2' applications just because it's too hard! This annoys users and inhibits search engine effectiveness, thereby reducing the potential of 'Web 2.'


Xanjax As A Solution

Following in the footsteps of a few others, the founder of Xanjax, David Chapman, itched for a solution, and eventually found he had to scratch the itch by attempting to solve the AJAX navigation issue.

Added Note: At the time of writing, David had no idea that Xanjax would become much more than an AJAX Navigation/History solution, yet remain much smaller than comparable history only solutions.

Considerable work, and even a couple of more or less complete solutions, such as Really Simple History, precede Xanjax. To David however, when he began Xanjax in about March 2007, without lots of extra work the existing solutions didn't seem to be small enough, fast enough, sufficiently bug free, or comprehensive enough for production web site design.

Size and speed limitations were the main deciders in David ruling out existing solutions. These issues seemed to be caused mostly by cross-browser compatibility issues, typically revolving around Microsoft browsers lack of proper W3C DOM support, rather than limitations directly imposed by the designers themselves who were obviously skilled and dedicated to the task.

Clearly, a different approach was needed; exploiting the limited common W3C compatibility that does exist cross browser, instead of multiple browser detection and patching. Most importantly, David decided, navigation should driven exclusively by events, rather than by resource consuming polling loops. Existing developers described using a hash appended url (meant for navigating to page anchors) to signal an AJAX update without causing a browser refresh. This technique provided a basis (with some known limitations and a few more ugly ones to be found and solved) for browser history retention and bookmarking, but it provided no direct hook for an event based solution.

This starting point for Xanjax lead to a most daunting and gruelling project. Superficially trivial, re-creation of browser navigational features in an event driven AJAX context was frustratingly elusive, as was the self imposed mantra for W3C common ground between browsers. Although David's original design goals weren't quite 100% realised, there was enough success for a fully event driven Xanjax to be born anyway. Other AJAX supporting modules (sufficient to build a functional web site at least as complex as this one, which is of course Xanjax Powered), got developed along the way.

Xanjax turned out surprisingly well; it's fully event driven, fast and tiny, with few known bugs. The essential components, which include live XML/XHTML to DOM conversion, consume less space and bandwidth than a typical minor graphic. The essential Xanjax index.html framework component validates to W3C XHTML 1.0 Strict and although Xanjax content is typically served as an XHTML 1.0 Strict subset of XML, there is flexibility to render earlier HTML specifications in object containers. As of April, 2009, all current popular browsers are supported by Xanjax; this includes Firefox, Google Chromium, IE 5.5, IE 6.1, IE 7.0, IE 8.0, Opera 9.51, Safari 3.1.1, SeaMonkey, and probably all other browsers based on current Mozilla and Webkit engines.

David has initially released Xanjax to the public as open source software under a GNU Affero general public licence, in the hope that it might become widely adopted and continuously improved.

If you want to use XHR/AJAX with traditional browser navigational capability in a minimalist framework, think Xanjax. Xanjax is the smallest known XHR history solution available; yet it is event driven, includes XML/XHTML to DOM insertion, CMS style Contexts, JSON and PHP support. Xanjax is so small that it's feasible to use it to include just a few AJAX pages in any existing website. Whether for building an entirely new website, upgrading an old one, or as the basis of a highly responsive browser based intranet or extranet application, please try and enjoy Xanjax.