Please see my comment to the question. As your functionality is not known, I'll give you only the basic idea, plus some suggestions I consider as the key ones.
First of all, all your client-side behavior is defined using JavaScript. (I don't count trivial behavior elements achieved using CSS, they only can change the view, cannot change any data.)
Normally, if you are online, you send most or all HTTP requests by clicking on anchor elements, sometimes by Submit button of some forms. This will "work" even for a disconnected user, because anyone can always go back from the error page to a previous page, but it would not look nice to the user. Therefore, I suggest you do create the system of HTTP request in response to the user UI action through Ajax:
http://en.wikipedia.org/wiki/Ajax_%28programming%29[
^].
With Ajax, you can always handle the response indicated failure (due to lack of connection, per your requirement) and, instead of going to an error page, just show it on your UI.
One convenient way of using Ajax is using jQuery:
http://api.jquery.com/category/ajax[
^].
With .NET, you can use one or another Ajax framework:
http://en.wikipedia.org/wiki/List_of_Ajax_frameworks#.NET[
^].
As you understand, all off-line resources will be available anytime, as soon as the application page(s) is already loaded in the browser (or even loaded from the browser
cache), but after disconnection, all Web resources will be completely unavailable. Depending on the required functionality, it leaves you the opportunity to support a lot of different user operations on the client side only. But what resources can be used? Not many. Consider this:
- You modify the page's DOM structure with JavaScript and can use data contained by DOM, as it remains intact.
- You can use local
sessionStorage
object and keep any data in it during the session, which won't be broken while you keep the browser open it your application page(s) loaded. - You can use permanent
localStorage
between sessions.
Please read about the use of Web storage, which is implemented by two embedded objects,
localStorage
and
sessionStorage
:
http://en.wikipedia.org/wiki/Web_storage[
^],
https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage[
^],
https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage[
^],
https://developer.mozilla.org/en-US/docs/Web/API/Storage[
^],
https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API[
^].
Be careful with
localStorage
, as it is stored permanently. The user can always remove it, but it's not nice, because it would need digging into browser's setting and can lead to removal of unrelated but valuable data. You need to provide a capability of cleaning storage related to your application:
https://developer.mozilla.org/en-US/docs/Web/API/Storage/removeItem[
^],
https://developer.mozilla.org/en-US/docs/Web/API/Storage/clear[
^].
—SA