[Note: This blog post is out of date. For up to date information on Dojo Offline please see the official web page.]

Hi folks; lots of news on the Dojo Offline front.First, we have put up a screencast that shows a demo of Dojo Offline named Moxie. Moxie is an example application bundled with Dojo Offline that shows how to use the Dojo Offline framework. It is a web-based word processor that features local storage and offline access. Moxie is now finished for Dojo Offline.

Thumbnail of beginning of Dojo Offline screencast for 02-20-2007

Watch the Dojo Offline Screencast

Next, we’ve finished the JavaScript layer of Dojo Offline. Dojo Offline consists of two major pieces: a JavaScript API that is included with a web application, and which helps with syncing, on/offline status notification, caching of data and resources, etc.; and a local small web proxy download that is cross-platform and cross-browser and which is web application independent. The JavaScript API is now finished, and can actually be used even though we have not finished the local web proxy yet. This is done by having the JavaScript layer be able to use the browser’s native cache if no offline cache is available. This means you can start playing with Dojo Offline right now, with the download link included in this blog post below. Note that using the browser cache instead of the web proxy is only suitable for prototyping and should not be deployed on production applications; it will work with varying degrees of success on Internet Explorer and Firefox, but not consistently on Safari. Higher levels of reliability will only come when we deliver the local web proxy component.

To start using Dojo Offline now in conjunction with the browser cache, you must have the following in your JavaScript code: dojo.off.requireOfflineCache = false. You must also turn on HTTP caching headers on your web server; how to turn on these HTTP headers and which ones to turn on are explained in the Dojo Storage FAQ. See the Moxie code links below for more examples of how to use the API. Note that the Dojo Offline JavaScript API has changed, especially for syncing, and has become much simpler — see the Moxie source for details.
The demo of Moxie shown in the screencast above can also be played with right in your browser. Please note that both Moxie and Dojo Offline are still alpha; you are literally seeing Dojo Offline being developed in front of your eyes, and glitches remain in both of them. Please debug and provide test cases for errors you find to help development.

Live Demo of Dojo Offline/Moxie here (alpha)

View the source code for Moxie’s JavaScript and HTML

You can also download a release of Dojo Offline from about two weeks ago that has the functionality described above, including the Dojo Offline JavaScript layer, Dojo, and Moxie:

Download Latest Dojo Offline Release (release-02-20-2007.zip)

Here’s some info on the directory layout. Look in release-02-20-2007/demos/storage to see the Moxie client side JavaScript and HTML files, and in release-02-20-2007/demos/storage/server/ to see the Java server side, composed of a Java servlet, a RESTian API, a simple data model and database abstraction layer, and a MySQL database.

The Dojo Offline JavaScript source code consists of the main dojo.off package inside release-02-20-2007/src/off.js; the dojo.off.ui package inside release-02-20-2007/src/off/ui.js; the dojo.off.files package inside of release-02-20-2007/src/off/files.js; and the dojo.sync package inside of release-02-20-2007/src/sync.js.

We highly encourage you to start hacking with Dojo Offline, using it to prototype offline web apps, using the Moxie client and server source as scaffolding for your own applications. All are open source and open for you to include and modify; please provide feedback and patches should you find or fix important bugs or add features.

The next step, began about 1 1/2 weeks ago actually, is development of the Dojo Offline download piece, the small web proxy. Development is moving along at a brisk pace on this. Already Polipo, the existing web based proxy written in cross-platform C, has been modified to load and save our list of offline-enabled web sites; produce a dynamically generated Proxy AutoConfig file based on this list; and to expose a simple API that can be scripted from our JavaScript in a reliable way to add or remove sites and see if the proxy is running and installed. The JavaScript layer has also been modified to tie into the local web proxy if it is available for adding or removing offline-enabled web sites transparently. I also setup a cross compilation environment with GCC and Mingw on my machine so that I can produce Windows executables from my Mac OS X box, which speeds up my productivity for producing cross-platform C builds.

To view the source so far, you can see off.h and off.c, two new files added to Polipo. The local web server bundled with Polipo (inside local.c) was also modified for our API that is scripted from JavaScript (see the newest version of dojo.off inside off.js on the Subversion repository here). Other files were also modified; see the full Dojo Offline Polipo directory here (this is inside the Dojo Subversion repository).

The next step is to continue working on the proxy, getting the on/offline detection code between the JavaScript layer and the local proxy better, as well as having the local proxy automatically go offline if it can not reach the network to resolve a proxy request, reattempting the proxy request from the local cache instead.

If the community wants to help, I would love if someone got the background JavaScript thread that looks for the network appearing and disappearing down to 1 through 5 seconds. It is currently at 15 seconds since I ran into some strange glitches on Firefox when I made it less. If you can reliably get it much lower, and test it across Safari, IE, and Firefox, that would be a great patch from the community.