Ok, so I said that I would create some sort of offline webapp tutorial
thing. So here goes:

There is one important thing that you need for this simple, easy to
use solution. It's PHP. If you don't have it, you'll have to list all
of the files you want to cache manually.

Step 1. Create a PHP file called manifest.php
Step 2. Put the following into it:

<?php
  header('Content-Type: text/cache-manifest');
  echo "CACHE MANIFEST\n";

  $hashes = "";

  $dir = new RecursiveDirectoryIterator(".");
  foreach(new RecursiveIteratorIterator($dir) as $file) {
    if ($file->IsFile() &&
        $file != "./manifest.php" &&
        substr($file->getFilename(), 0, 1) != ".")
    {
      echo $file . "\n";
      $hashes .= md5_file($file);
    }
  }
  echo "# Hash: " . md5($hashes) . "\n";
?>

Step 3. Put manifest.php in the directory of the webapp that you want
to use offline
Step 4. Replace your <html> tag with <html manifest="manifest.php"> in
the index.html, index.php, etc. file

Note: That md5 hash is necessary so that every time you add a new
file, or edit one, the hash changes, forcing the device that is using
the webapp offline to re-cache, and update its offline files.

Alex

P.S. A more in-depth tutorial, that manually list files, with an
example can be found here: 
http://www.thecssninja.com/javascript/how-to-create-offline-webapps-on-the-iphone

-- 
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/iphonewebdev?hl=en.

Reply via email to