Skip to content
Browse files

initial commit

  • Loading branch information...
1 parent 5048d08 commit 1268f262ea040c7f55e2d0c3dcca4fe556bfdfed @bjornbjorn committed Oct 3, 2011
Showing with 71 additions and 0 deletions.
  1. +1 −0 .htaccess
  2. BIN apple-touch-icon.png
  3. +5 −0 cache.manifest
  4. BIN images/logo.png
  5. +25 −0 index.html
  6. +36 −0 offlinetest.js
  7. +4 −0 style.css
View
1 .htaccess
@@ -0,0 +1 @@
+AddType text/cache-manifest .manifest
View
BIN apple-touch-icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
5 cache.manifest
@@ -0,0 +1,5 @@
+CACHE MANIFEST
+style.css
+offlinetest.js
+images/logo.png
+apple-touch-icon.png
View
BIN images/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
25 index.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<html manifest="cache.manifest">
+<head>
+ <meta charset="utf-8">
+ <title>Minimal HTML5 iPad Offline Cache Test</title>
+ <meta name="viewport" content="width=device-width,initial-scale=1">
+ <meta name="apple-mobile-web-app-capable" content="yes" />
+ <meta name="apple-mobile-web-app-status-bar-style" content="default" />
+ <meta name="apple-touch-fullscreen" content="yes" />
+ <link rel="apple-touch-icon" href="apple-touch-icon.png"/>
+ <link rel="stylesheet" href="style.css">
+
+</head>
+<body>
+
+<section id="content">
+ <h1>Minimal HTML5 iPad Offline Cache Test</h1>
+ <p>Welcome, this page should be cachable and webclip'able.</p>
+ <p><em>Don't forget</em> to <a href="http://manifest-validator.com/">validate your cache.manifest</a> file and <a href="http://www.bybjorn.com">read the blogpost</a>.</p>
+ <img src='images/logo.png' alt="HTML5 logo" />
+</section>
+
+ <script src="offlinetest.js"></script>
+</body>
+</html>
View
36 offlinetest.js
@@ -0,0 +1,36 @@
+var appCache = window.applicationCache;
+
+function handleCacheEvent(e)
+{
+
+}
+
+function handleCacheError(e) {
+ alert('Error: handleCacheError called. It is OK if this is called in OFFLINE mode. If this is called while online something is wrong.');
+};
+
+// Fired after the first cache of the manifest.
+appCache.addEventListener('cached', handleCacheEvent, false);
+
+// Checking for an update. Always the first event fired in the sequence.
+appCache.addEventListener('checking', handleCacheEvent, false);
+
+// An update was found. The browser is fetching resources.
+appCache.addEventListener('downloading', handleCacheEvent, false);
+
+// The manifest returns 404 or 410, the download failed,
+// or the manifest changed while the download was in progress.
+appCache.addEventListener('error', handleCacheError, false);
+
+// Fired after the first download of the manifest.
+appCache.addEventListener('noupdate', handleCacheEvent, false);
+
+// Fired if the manifest file returns a 404 or 410.
+// This results in the application cache being deleted.
+appCache.addEventListener('obsolete', handleCacheEvent, false);
+
+// Fired for each resource listed in the manifest as it is being fetched.
+appCache.addEventListener('progress', handleCacheEvent, false);
+
+// Fired when the manifest resources have been newly redownloaded.
+appCache.addEventListener('updateready', handleCacheEvent, false);
View
4 style.css
@@ -0,0 +1,4 @@
+body {
+ font-family: sans-serif;
+ text-align: center;
+}

0 comments on commit 1268f26

Please sign in to comment.
Something went wrong with that request. Please try again.