我有一个在iPad上以独立模式(添加到主屏幕)运行的JavaScript应用程序。
我已经从iOS 6升级到iOS 7,现在我的应用程序总是加载相同的内容,它一直在缓存。即使我在每个应用程序上动态加载我的JS和CSS文件,也会使用唯一的时间戳作为参数加载。我需要它来确保JS和CSS文件不会被缓存,并且它可以在iOS 6中工作。
我尝试了以下几种方法:
data
manifest="manifest.appcache"
removed (然后重试1到3)<meta http-equiv="cache-control" content="no-cache">
和
<meta http-equiv="pragma" content="no-cache">
因此,无论是在HTML文件中还是在JS中,我所做的所有更改都不会出现。
显然,iOS处理独立应用的方式有一些变化。我遗漏了什么?
发布于 2013-09-27 05:28:49
Mobile Web App not clearing cache properly
干杯,Z.
发布于 2013-12-16 16:17:50
只需删除HTML中的清单引用即可。也就是说,不要使用清单文件。
同时,您的清单文件是否提供了正确的mimetype?
发布于 2013-12-17 06:27:27
我发现这个php脚本可以将正确的manifest.cache文件输出到浏览器。
我前段时间做的可能会有帮助。
它会自动检查某些文件是否被修改,并强制浏览器重新加载新的manifest.cache。
manifest.php
<?php
header("Cache-Control: max-age=0, no-cache, no-store, must-revalidate");
header("Pragma: no-cache");
header("Expires: Wed, 11 Jan 1984 05:00:00 GMT");
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 "NETWORK:\n";
echo "*\n";
echo "FALLBACK:\n";
echo "online.html fallback.html\n";
echo "# Hash: " . md5($hashes) . "\n";
?>
我无法在ios 7上测试atm
https://stackoverflow.com/questions/18959222
复制相似问题