Xanjax aims to be the smallest, fastest, navigable XHR/AJAX framework available.
The ultra tiny Xanjax Core is the "Tardis" of AJAX Frameworks! At just 10K, (3K minified/compressed) there's far more functionality inside than can be believed.
Xanjax provides an XHR/AJAX navigation layer typically driven by simulated navigation events, which empowers the XHR/AJAX web designer in situations where the traditional browser navigation model must not be broken. In practice, the desirability of traditional browser navigation extends to all situations in which the browser is being used as an information resource interface, as opposed to an application control interface. This website showcases the ability of Xanjax to provide site-wide content via XHR/AJAX; the entire Xanjax website is loaded via XHR; using Xanjax's event driven navigation layer to maintain traditional browser navigational behaviour.
XMLHttpRequest (XHR) and other AJAX methods do not in themselves support browser navigation. This has been a barrier to more widespread adoption of XHR/AJAX. Compounding this difficulty, cross-browser navigational behaviour ranges from inconsistent to very buggy. Creating your own AJAX navigation system is likely to take a thousand times longer than creating the website you need it for!
Xanjax's navigation layer automatically decouples from simulated events to directly exploit the new 'onhashchange event' introduced with IE8; it can also degrade to polling to overcome Webkit's hidden scrollbar bug in both Safari and Chromium. Because Xanjax uses behaviour detection rather than browser detection, Xanjax automatically uses the optimum navigation coupling for any browser.
Xanjax normally responds to navigation changes using hashchange navigation events. This means Xanjax is faster than other XHR/AJAX history solutions because there are no polling loop delays added to AJAX requests.
Xanjax supports all major browsers using simulated hashchange events. Xanjax automatically upgrades from simulated hashchange events to browser 'onhashchange' events supported by IE8, and will automatically pick up this event type as it is introduced into other browsers. Only Webkit based browsers with the "hidden scrollbar bug" automatically degrade to polling. In the unlikely scenario that a designer wishes to use navigation polling, rather than navigation events, it is trivial to degrade Xanjax's behaviour.
XML is not directly compatible with most current generation browser DOM's. Most still only support HTML4 at the DOM level rather than XHTML; even when DOCTYPE is specified as XHTML. This, together with major IE browser DOM bugs some of which still exist in IE8's standards mode, virtually excludes the use of XHR to deliver XHTML content directly. To date, XHR has been mostly limited to relatively small blocks of XML or JSON which must either be reformatted, and/or inserted by the non-standard innerHTML.
Xanjax addresses this problem by supporting live conversion (of the XHTML subset) of XML to HTML DOM. This means it's trivial for designers to insert content simply by serving XHTML 1.0 content as XML, using the file extension xml instead of htm or html. PHP (or other server side content) can use normal file extensions but must prefix any XHTML 1.0 content delivered as XML with a header of content-type text/xml.
In Xanjax, XHTML 1.0 is the preferred content delivery mode for main page content, because it readily degrades for Search Engine Optimisation (SEO) and Accessibility whereas straight XML or JSON obviously does not. Note that degradability is facilitated by Xanjax design, and therefore relatively easy to implement, but the decision is up to the designer and still requires some effort.
Unlike many other XHR/AJAX solutions, Xanjax core is fully implemented client side which means significant bandwidth and scalability benefits, even when combining Xanjax with server side content. Additionally, Xanjax supports 'contexts' fully client side; traditionally this feature has only been provided by server side CMS. Interestingly, this means it's feasible to provide dynamic contexts (or dynamic, dynamic content) using Xanjax and server side CMS together; without needing your own server farm, or reducing your affordable server to a nervous zombie!
Xanjax helps you use XHR to create faster, more responsive websites. Server driven XHR solutions typically do quite the opposite, enfuriating even the most patient users!
Xanjax offers the designer "virtual frames." Xanjax does not use HTML Frames, not even Iframes, because they're not part of the XHTML 1.0 Strict specification. Of course there's nothing to stop a designer making use of Iframes if she or he wishes.
Although HTML frames fell out of favour largely due to serious SEO, accessibility, and browser navigation issues, they did nevertheless assist designers with layout and separation of navigation from content. Web-2/XHR/AJAX re-opens this can of worms. Along with wide-ranging benefits, use of XHR brings us back to the same old SEO, accessibility, and browser navigation issues, formerly experienced when using HTML frames.
Xanjax helps address these problems by implementing a virtual navigation layer. This makes virtual frames a reality, and in fact this website implements a virtual navigation frame containing the main menu; a virtual main content frame which reflects the page address and page title; and some virtual contextual content frames which are used to supplement main content.
Xanjax now offers, fully client side, powerful content management system features typically only found in speicialised server side CMS applications.
Unlike main content, typically of substantial size and variable structure, supplementary and contextual content is often of small size with relatively constant structure. XHTML clearly suits major content, whereas JSON is highly efficient for supplementary content. XML, also useful for supplementary content, is widely used for data feeds. While there is much argument about the relative virtues of JSON vs XML the reality is that both will continue to prosper.
Xanjax already has built in JSON support for templating supplementary/contextual content and templated XHTML delivery via XML is supported too. Because JSON is a subset of JavaScript, support for it is easy, compact and efficient to implement; which is the main reason for Xanjax supporting JSON more broadly than XML. This website makes use of JSON or XHTML for all supplementary contextual content. A single template file (which can optionally call sub templates) defines these contexts and associates them with relevant content. This concept is a feature more typical of server side CMS, but Xanjax achieves it fully client side, reducing bandwidth, and moving the processing load to the client.
Whatever you think of PHP, its use on the web is ubiquitous. Support for GET and POST in Xanjax XMLHttpRequest enables use of PHP, and other server side languages. At this time only PHP has been tested with Xanjax. This website makes use of PHP for webmail services and to demonstrate server pushlets. Realtime Server Pushlets demonstrate a fairly specialised use case of PHP within Xanjax.
As a further demonstration of Xanjax's extraordinary flexibility, the WordPress 2.7 based Xanjax Blog is fully encapsulated by Xanjax into a single DIV element. This was achieved with very little modification of either Xanjax or WordPress. In fact significant parts of the unmodified WordPress using it's default theme run normally Xanjax.
Xanjax supports (at least) the following browsers: Firefox 2 & 3; Google Chromium, Internet Explorer 5.5, 6.1, 7.0 & 8.0; recent Mozilla Based Browsers; Opera 9.51; Safari 3.1.1; and recent Webkit Based Browsers. At the time of writing, Webkit based browsers have a hidden scrollbar bug requiring Xanjax to automatically degrade to polling for navigation. Also note that some Webkit based browsers are under heavy development and fail for reasons not directly related to Xanjax.
Xanjax is XHTML 1.0 Strict conforming. Xanjax does not use any deprecated methods such as hidden Iframes to force browser state. Neither does it require or use Flash for similar purposes, although Flash use is not restricted. Xanjax functions at all browser security levels which permit Javascript, CSS, and XMLHttpRequest. In other words, Xanjax works with any standard browser installation without requiring plugins, it works at the highest XHR/AJAX enabled security levels, and it conforms with XHTML 1.0 Strict specifications.
Work is almost complete on an optional server side PHP module which extends SEO and non javascript browser degradability to more fully reflect XHR/AJAX content when client side CMS is employed. This module should be released in a matter of weeks.
