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:
I have also set up my .htaccess file to the correct MIME-type:
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).
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:
Code:
CACHE MANIFEST
index.html
Icon.jpg
NETWORK:
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:
Code:
<!DOCTYPE HTML>
<html manifest="cache.manifest">
<head>
<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"/>
<script>
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()
{
statBar.innerHTML='Updated';
}
cache.onprogress= function()
{
statBar.innerHTML = statBar.innerHTML + "Progress!";
}
</script>
<title>New Web Project</title>
</head>
<body>
<h1>New Web Project Page</h1>
<div id="statBar">Status:</div>
<script>
statBar = document.getElementById("statBar");
</script>
</body>
</html>
I have also set up my .htaccess file to the correct MIME-type:
Code:
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).
Last edited: