0

I have the following appcache manifest:

CACHE MANIFEST

# Cache Manifest timestamp: 1361723106
CACHE:
offline.html
offline2.html
offline.manifest.php

NETWORK:
*

FALLBACK:
/ offline.html

I am using this on my local installed server. So when I load the index.html file which links to this manifest file, the consolse in Chrome shows me that all files are cached properly. When I now shut down my local server and try to access the index.html file again, then I see the content of that index.html file. I was expecting to be "forwarded" to offline.html. What am I doing wrong?

Thanks in advance!

Daniel
  • 2,409
  • 2
  • 26
  • 42

1 Answers1

0

Although you speak of an "index.html" file, I'm assuming you're accessing the resource like this: http://yourlocalservername/ .

The resource that links to the appcache manifest (in this case "/") is always included in the application cache. Fallback applies to resources which are not in the cache, so the result you get is expected.

The only way to show an "offline indicator" when accessing a previously cached resource, is to ensure the cached resource includes javascript code that actually checks if the browser is offline. You could check navigator.onLine and/or check with XMLHttpRequest to see if your server is reachable (and functioning).

Myrne Stol
  • 11,222
  • 4
  • 40
  • 48