Click here to Skip to main content
15,939,243 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on a site to be used by field engineers on various tablet devices. The entire site (all pages, CSS, images, javaScript files etc) must be available offline once the user has logged into the site.

To facilitate this, I am using the appCache manifest file to list every file that will be required in the "CACHE" section. My understanding is that this will cause the browser to cache the resources for offline use, but only once those resources have been requested by the browser for the first time. i.e. the application manifest alone is not going to cause those resources to be fetched from the server.

I require the user to be able to log in, then work offline if required. I ideally need to prefetch all resources listed in the appCache manifest after successful login so that they may be used offline thereafter.

On successful login, I am using many calls to JQuery $.get(); to request every resource required for offline use. My understanding is that this will cause a HTTP GET request to fetch the resource and that because of the cache manifest (which lists the resource under "CACHE"), that those resources will be cached for offline use.

Am I missing a trick here? The reason I ask is that I'm getting unexpected results (not able to navigate to an "unvisited" page when offline).

Any assistance is much appreciated. :)

1 solution

I figured this one out.

My Prefetch code was requesting "Scripts/business/file1.js".

My navigation code was requesting "scripts/business/file1.js"

My manifest file was listing "Scripts/business/file1.js"

i.e. The lower case "s" in the navigation code, Changing the navigation code resulted in the offline mode working as anticipated.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900