- offlining the static resources is the easy part and modern browsers and google gears provide all kind of support for that.
- offlining the dynamic requests is extremely difficult. The server logic needs to be modeled on clientside and the risk of getting data inconsistencies is big. So let's leave that part for another day.
Unfortunately all the popular browsers (I tested with the newest betas) and google gears provide different ways of how to handle the offlining of static resources:
Firefox 3.1beta
Supports the HTML 5 offline API and has a menu option to simulate the offline mode. The static resources need to be listed in a manifest file:
and that manifest file name becomes an attribute of the
Safari 4beta
CACHE MANIFEST
/index.html
/default.css
/images/logo.png
and that manifest file name becomes an attribute of the
html
tag of the app start page:
test
test
Also supports the HTML 5 offline API, therefore everything the same as with Firefox, except there is no easy way to simulate the offline mode. Just turning off the internet connection does not help if you use a server on localhost for development.
Google gears for all the other browsers
And the loading of the manifest has to be done in Javascript:if google && google gears
var localServer = google gears factory create'beta.localserver';
var store = localServer createManagedStore'test-dev';
store manifestUrl = '/cache-manifest.gears';
store checkForUpdate;
Because the HTML 5 / gears manifest files have a different format and easily grow beyond manually manageable size, a tool (or a custom build step) is necessary to create and update the cache manifest file for complex apps.
No comments:
Post a Comment