Cannot get web application offline on iPod

I wrote a basic web application such as a password manager for offline work on a mobile device (testing on iPod Touch 4th generation). I added the application to the main screen, and all this works fine while the iPod is online and can get to the server. As soon as I turn on the iPod offline, the following dialog box appears when I open the application:

Can't open PwdThing

PwdThing cannot be opened because it is not connected to the Internet

One static HTML file for the application ( passwordthing.html ) points to a manifest file:

 <html manifest="cache.manifest"> ... 

The cache.manifest file contains all the files used by the application (including jQuery Mobile ):

 CACHE MANIFEST passwordthing.html passwordthing.js ... 

And the cache.manifest file cache.manifest configured to serve text/cache-manifest in the .htaccess file:

 AddType text/cache-manifest .manifest 

All source files are on Github ( this commit is the version at the time of writing), and I installed a public server to install it as well.

Why can't I make my application work offline?

+5
jquery html html5 web-applications
Nov 20 '10 at 1:26
source share
3 answers

The only thing I can think of is that you did not modify the file, and the mobile safari cached the old version of the manifest. Add a comment to the manifest. You can also try changing the name of the manifest file itself; I had to do this in order to cache my iPad - every time I update my application, I change the manifest name to include the date.

Please note that iOS4.2 has much better manifest support. You can see things improve when he is absent.

Edit - Or, as it turned out, this is just a bad filename;) (see comments on the question).

+2
Nov 20 '10 at 2:34
source share

[[Replicated my answer here below, because it can be applied here:]]

I found that debugging standalone HTML5 applications is a pain. I found the code from this article, helped me figure out what happened to my application:

http://jonathanstark.com/blog/2009/09/27/debugging-html-5-offline-application-cache/

Debugging HTML 5 Offline Application Cache by Jonathan Stark

If you want to provide offline access to your web application, the offline application cache available in HTML5 is a killer. However, this is a giant PITA for debugging, especially if you are still trying to get around it.

If you're struggling with the cache manifest, add the following JavaScript to the HTML main page and view the console output using Firebug in Firefox or Debug> Show Error Console in Safari.

If you have any questions, plmk in the comments.

NTN
J

 var cacheStatusValues = []; cacheStatusValues[0] = 'uncached'; cacheStatusValues[1] = 'idle'; cacheStatusValues[2] = 'checking'; cacheStatusValues[3] = 'downloading'; cacheStatusValues[4] = 'updateready'; cacheStatusValues[5] = 'obsolete'; var cache = window.applicationCache; cache.addEventListener('cached', logEvent, false); cache.addEventListener('checking', logEvent, false); cache.addEventListener('downloading', logEvent, false); cache.addEventListener('error', logEvent, false); cache.addEventListener('noupdate', logEvent, false); cache.addEventListener('obsolete', logEvent, false); cache.addEventListener('progress', logEvent, false); cache.addEventListener('updateready', logEvent, false); function logEvent(e) { var online, status, type, message; online = (navigator.onLine) ? 'yes' : 'no'; status = cacheStatusValues[cache.status]; type = e.type; message = 'online: ' + online; message+= ', event: ' + type; message+= ', status: ' + status; if (type == 'error' && navigator.onLine) { message+= ' (prolly a syntax error in manifest)'; } console.log(message); } window.applicationCache.addEventListener( 'updateready', function(){ window.applicationCache.swapCache(); console.log('swap cache has been called'); }, false ); setInterval(function(){cache.update()}, 10000); 
+1
Dec 05 2018-10-12T00:
source share

Also, make sure cache.manifest has the correct specification (in my case UTF-8) that matches your HTML file. If you only have an ASCII BOM file and the content type is set to UTF-8, caching will fail.

Hth someone.

Kristin Boersen

0
Oct 11
source share



All Articles