There is only one way to get a webapp offline today: cache manifest.

Cache manifest is pretty simple on the paper: once online, you access to an
url. This url as a "manifest" attribute in the html tag, so the browser
knows where to find it and read it.
This file is a list of urls you want the browser to keep a copy locally.
Those urls are grouped as "cache", "fallback" & "network". urls could refer
to any file (except videos afaik). But once the browser have cached those
urls locally, he will simply not ask the server again to serve this file.
except the manifest file itself got corrupt, updated or is missing. Even is
user phone/tablet has signal. That's the whole point.

This is why i'm asking if the content is sensible and if you need offline
login.

If not, then do the login online, and only put a manifest reference on the
html tag once user is logged in. So you know only logged users can has a
manifest-based local copy of the app.
This could be "simple" to implement, but means you store the app & its
content in its logged status & until user keeps offline, he can access
app+content forever. (if user is banned or fired, just empty his/her
manifest file and app would be removed locally - then next time it would
ask online to the server to serve the content -> login screen).

If you need user to login each time + have dynamic content, then you need
to totally recreate the app to split everything between what's the app &
what's the content. So you can use the manifest file to store what is the
app files, and populate the app with datas from the online database via
Ajax calls (when online) or from the local storage (localStorage or
localDatabase are the two options). The exact same process of a native app
in fact, and the only way to do it properly. Here, you can ask online for
login/pass check, and fallback to an localStorage hash test when no signal
/ too long.

Not an easy job for sure, but a very interesting one, and totally
server-side tech agnostic (in both cases).


I'll give you 2 examples using Emy rather than iUI just because demos are
online and functional, but the exact same could be done with iUI since it's
not really related to the frontend library at all.

Emy cache manifest plugin :
http://www.emy-library.org/emy/1.0/plugins/cache-manager/cache-manager-demo.html
(see you the logo image switch from "online" to "offline", based on what's
in fallback in its manifest file)

Emy Note app demo : http://www.emy-library.org/demos/notes/notes.html
(see how views are empty, datas stored in localStorage as a JSON string,
parsed onload to populate the app)

Hope this help.

Remi

-- 
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/iphonewebdev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to