View Full Version : HTML5 offline cache doesn't seem to work

Jul 27, 2011, 07:06 AM
Hi all,

I am trying to understand how HTML5 offline cache works, so that I can develop offline web apps, and having a real hard time at it. In fact, I've been testing this on and off since the last three weeks. I've read numerous tutorials, including the docs on the offline cache available at developer.apple.com. But so far I haven't gotten it to work properly.

I set up my cache manifest like this:



Notice that there are no resources that always depend on the server, so I leave the NETWORK: section blank (the apple dev docs say it is required, though not including it makes no difference).

I also set up my index.html like this:

<html manifest="cache.manifest">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
<meta name="apple-mobile-web-app-capable" content="yes" />

<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="Icon.jpg"/>

cache = window.applicationCache;

cache.onchecking = function()
statBar.innerHTML="Status: Checking";

cache.ondownloading= function()
statBar.innerHTML="Status: Downloading";

cache.oncached = function()
statBar.innerHTML="Status: Cached:";

cache.onerror = function()
statBar.innerHTML='Status: An Error ocurred.';

cache.onupdateready= function()

cache.onprogress= function()
statBar.innerHTML = statBar.innerHTML + "Progress!";

<title>New Web Project</title>
<h1>New Web Project Page</h1>

<div id="statBar">Status:</div>
statBar = document.getElementById("statBar");

I have also set up my .htaccess file to the correct MIME-type:

AddType text/cache-manifest .manifest

When accessed on the iPod, the progress DIV displays "Checking" Then "Downloading" a few times, then it throws the onerror event, displaying "An error ocurred". And, if I add to the Home Screen and click on it, it opens followed by a "No connection" message, then closes automatically.

I know this doesn't really have anything to do with Objective-C, but it still has to do with iOS programming, so hopefully this question will not get banned for being off-topic. I would not be asking this here if I didn't already feel I've run out of other online resources to help me troubleshoot the problem. So, if anyone can tell me what I'm doing wrong, it would be very appreciated. (The pages are currently hosted on http://www.factordice.com/html5).

Jul 29, 2011, 08:17 AM
Please, if anyone has any information on this issue, I would very much appreciate help. If iOS simply does not support HTML5 offline caché, I'd like to know also (although the information on developer.apple.com claims that it does). I've run out of options, and I still do not know what I am doing wrong. Thanks in anticipation.