1. Introduction - Glidias/Kilogaiajax GitHub Wiki
What is Kilogaiajax?
Kilogaiajax is a javascript framework (requiring JQuery) to help develop and manage ajax-driven websites with full SEO support (via History API for HTML5 browsers and SWFAddress for HTML4 browsers/hashbang-usage). This means it provides a way to dynamically load pages (ie. HTML content) to be transitioned in, with changing URL addresses in the browser, without having to refresh the browser. However, some websites may have additional needs when loading content pages by Ajax, and Kilogaiajax supports the following features to fill in the gap:
- Page specific assets that you wish to preload, such as page-specific .css files, .js files, .json files and images.
- Page-specific javascript code to run for a particular HTML page once all assets are preloaded!
- A fallback to HTML4 browers via SWFAddress (hashbang-only) routing.
- Default transition in/out methods for pages, event hooks for transitions and phases before/after preloading, before/after transitioning in a page, before/after going to a particular valid route branch, or when a deeplink/navigation event occurs due to changes in History URL or SWFAddress hashbang changes.
- Javascript redirection for HTML4 browers to homepage, with hashbang included, in order to clean up misleadingly ugly ambiguous URLs (eg. About page vs Homepage ? "about.html#/home" ) in the address bar.
- Resolving between hashbanged (HTML4) urls vs non-hashbanged (HTML5) urls when landing on a particular website page to display the correct url based on the target browser.
- Built-in Google Analytics tracking support for pages, or you could use the event hooks to perform your own tracking.
Note: Some ajax sites (in particular apps), may simply involve a single compiled .css file and library compiled .js file that is used for the entire site that already includes all the class instances/functions to be created/executed for specific pages/routes. Kilogaiajax does support this approach of loading all assets (compiled codebase) at once, and only load plain html content only afterwards. After all, this approach would seem more friendly/flexible for all types of sites, including applications. It mainly results in overall less repeated http loading dependencies/load calls (which is an intention of Ajax, actually).
To emulate the above, is quite simple, you just need to set up several Kilogaiajax default event handler hooks from which you can initialize the relevant classes/methods depending on the page being visited. link here
Kilogaiajax is mainly inspired from the AS3 Gaia Flash Framework for the Adobe Flash Platform . Thus, there are certain paradigms such as a Site XML that is used to declare the valid page routes available, and any page assets required to preload before transitioning in a page's html contents. These aspects of the frameworks were ported over to Javascript. Like it's Flash-counterpart, It may not be the best model for developing websites on it's particular platform (after all, why does every page route need a page .swf/.html assosiated with it??), but is one of the prescribed ways to easily convert an existing site to an Ajax-driven one. Just like how Gaia Framework assumes a website consisting of multiple .swfs, Kilogaiajax assumes a website consisting of multiple seo-friendly html-outputted files as a main driving reason for developing the framework. If your website isnt' like this, you might consider going for a more open-ended app-friendly routing solution like Davis.js. Or you could stick with Kilogaiajax and take advantage of it's already-available built-in site event hooks, it's Site XML model, etc. to create a custom app that works purely on hashbang routing. Or, another approach is to just live with loading dummy (ie. unused) .html files per page branch, and handle your navigation routing code globally, while still taking advantage of the ability to make use of preloadedable assets per page-branch. I've yet to explore all the possible use-cases for this framework, even though currently I'm just developing traditional SEO-friendly sites with it for now.