0

I have 2 files: index.php and offline.html. I simply want to have dynamic content in the index.php (no cache on this) but when the user is offline I want to fallback to offline.html.

With my example below, Google Chrome caches index.php and when I'm offline it loads index.php - NOT offline.html (which it should) Any ideas here? Am I missing something obvious?

index.php:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" manifest="my.appcache">
<body>
<?php echo 'Online!';?>
</body>
</html>

offline.html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" manifest="my.appcache">
<body>
Offline!
</body>
</html>

my.appcache

CACHE MANIFEST
# 2010-06-18:v2

CACHE:

NETWORK:
index.php

FALLBACK:
index.php offline.html
user1427930
  • 109
  • 2
  • 9

2 Answers2

0

have you solved this yet?

In FALLBACK:

Try

Replacing index.php with /

And

change offline.html to /offline.html

Let me know if it works for you.

Kurubaran
  • 8,696
  • 5
  • 43
  • 65
0

Late answer, but... Specify in your index.php to not cache:

<?php header("Cache-Control: no-cache, must-revalidate"); ?>

as the first line of your file.

in your manifest, you can take index.php out of network as the fallback specifies the handling of it.