我有一个html5清单hello world设置了一个页面
<!DOCTYPE html>
<html manifest="/manifest.appcache">
...
和清单
<?php header('Content-Type: text/cache-manifest');?>
CACHE MANIFEST
CACHE:
/dummyjs.js?asd=1
...
它适用于chrome但它在firefox(ubuntu)上根本不起作用,我检查了服务器日志,firefox在获取页面后没有请求manifest.appcache,我读了this answer并且我检查了如果服务器正在发送这些标题,但它似乎没有(这里是请求和响应标题)
Header della richiesta 01:45:53.000
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0
Host: 127.0.0.1
Connection: keep-alive
Cache-Control: max-age=0
Accept-Language: it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Header della risposta Δ0ms
X-Powered-By: PHP/5.5.9-1ubuntu4
Vary: Accept-Encoding
Server: Apache/2.4.7 (Ubuntu)
Keep-Alive: timeout=5, max=100
Date: Mon, 12 May 2014 23:45:53 GMT
Content-Type: text/html
Content-Length: 524
Content-Encoding: gzip
Connection: Keep-Alive
有趣的是它可以在windows上运行,ubuntu和windows都有最新版本,但是firefox忽略了ubuntu上的manifest属性。我很感激任何建议。
答案 0 :(得分:0)
1)检查是否设置了no-cache/no-store
标题。
2)将.appcache
个文件的内容类型更改为text/cache-manifest
。对于Apache:
AddType text/cache-manifest .appcache
3)您可以尝试通过javascript强制缓存更新:
var appCache = window.applicationCache;
appCache.update(); //this will attempt to update the users cache and changes the application cache status to 'UPDATEREADY'.
if (appCache.status == window.applicationCache.UPDATEREADY) {
appCache.swapCache(); //replaces the old cache with the new one.
}
答案 1 :(得分:0)