Offline First – A Better HTML5 User Experience
The most useful pattern I know of for offline web apps is the command queue.<p>Basically, the rendered state of the client is the acknowledged server state plus the client-side command queue.<p>User actions don't make a server request and then update the UI. Instead they directly append to the local command queue, which updates the UI state, and right away the client begins communicating with the server to make the local change real.<p>While the client's command queue is nonempty, the UI shows a spinner or equivalent. If commands cannot be realized because of network failure, the UI remains functional but with a clear warning that changes are waiting to be synchronized.<p>(The API for connectivity status are useful for making sure that the command queue resumes syncing when the user's internet comes back.)