HTML 5 cache file is cached itself

I have a problem with the cache.manifest file being cached itself. The value of each change in the file is not displayed on (Mobile) Safari, so it will never be updated and display the latest cached files.

I tried to avoid this by using a file .htaccessin the same directory as the file cache.manifest:

ExpiresActive On
ExpiresDefault "access"

This did not help, so I changed cache.manifest in the php file that contains the following headers:

header("Expires: Mon, 26 Jul 1990 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 
header("Cache-Control: no-store, no-cache, must-revalidate"); 
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header('Content-Type: text/cache-manifest'); 

Does anyone have any other ideas on how I can make sure the cache file itself will be extracted if possible?

Works on: Safari (desktop), Chrome (Samsung Galaxy Tab v10.1), Firefox
Failed: Chrome, Safari (iOS)


Renamed cache.manifest.php back to cache.manifest and added the following lines to .htaccess

<IfModule mod_expires.c>
    Header set Cache-Control "public"
    ExpiresActive on

# cache.manifest needs re-requests in FF 3.6 (thx Remy ~Introducing HTML5)
    ExpiresByType text/cache-manifest       "access plus 0 seconds"
</IfModule>

cache.manifest Safari (iOS), . .

+3
4

HTML5, , , HTTP - /etc, , .

, :

# last modified: Thu, 30 Jun 2011 01:19:46 GMT

- , , .

+3

, - , .

PHP "build" script HTML5.

Chrome, Firefox, IE8 +, Android iOS.

: https://github.com/JasonHanley/note5/blob/master/build.php

ExpiresByType text/cache-manifest " 0 " .htaccess, , .

+1

, SimpleCoders , Apache cache.manifest Server Side Includes, :

CACHE MANIFEST
# <!--#flastmod file="index.html"-->
# <!--#flastmod file="whatever.js"-->
# <!--#flastmod file="whatever.css"-->
whatever.js
whatever.css

, , - , . , : Apache config - :

Alias /whatever /var/www/whatever
<Directory /var/www/whatever>
     Options +Includes
     AddHandler server-parsed .manifest
</Directory>
CacheDisable /whatever/ihealth.manifest

, , "200 Okay", "304 Not Modified".

+1

- - .

; , , , . ( #), , .

Simply modifying the files that reference the manifest will not force the browser to reload the manifest. If this is what you were hoping for, try the following: use the PHP file to create the manifest. Of course, use headerto set the correct MIME type. After you have allocated all your resources, allocate a timestamp hash of all these resources. Thus, if one of them is changed, the manifest file will change. This is what I use:

// Collect a list of resources we need to check (customize to your needs)
$files = array(
    "/scripts/script1.js",
    "/scripts/script2.js",
    "/scripts/script3.js",
    "/scripts/script4.js",
    "/css/style.css"
);

$filetime = 0;
foreach ($files as $file) {
    $filetime += filemtime($file);
}

// This echoes out the hash of the filetimes as a comment
echo "#" . sha1($filetime);
0
source

All Articles