2015-04-04 48 views
0

我遇到了我的网站的appcache和清单文件问题。Appcache不起作用:清单获取失败(404)

demo.appcache文件:

CACHE MANIFEST 
/img/logoSmallSmall.png 
/crosshair.html 

HTML,我想缓存:

<!DOCTYPE html> 
<html manifest="demo.appcache"> 
<head> 
    <title>crosshairs</title> 
</head> 
<body> 
    <h1>katse</h1> 
     <img src="img/logoSmallSmall.png" alt="image text" onclick="javascript:alert('Your popup message');" /> 
     <div style="display: none;">sdsd</div> 
     <img src="img/logoSmallSmall.png" alt="image text" onclick="javascript:alert('Your popup message2');" /> 
     <div style="display: none;">sdsd</div> 
     <img src="img/logoSmallSmall.png" alt="image text" onclick="javascript:alert('Your popup message3');" /> 
     <div style="display: none;">sdsd</div> 
</body> 
</html> 

该行添加到的.htaccess:

AddType text/cache-manifest .appcache 

在Chrome的JavaScript控制台给了我这样的错误:

Application Cache Error event: Manifest fetch failed (404) 

有人能帮助我解决这个问题?

+0

你的目录结构是什么样的? .appcache文件位于何处? – lemieuxster 2015-04-04 22:06:17

+0

.appcache位于我的HTML文件所在的同一目录中。 – OFFLlNE 2015-04-05 11:44:22

+0

如果直接点击清单网址,它会加载“http://yoursite.tld/demo.manifest”?另外,你有没有尝试过这个工具? http://manifest-validator.com/ – lemieuxster 2015-04-05 14:28:20

回答

2

发现整个问题都是因为文件名。 所有你需要做的就是命名文件:cache.manifest,这是你所要做的所有事

+0

我想知道为什么这解决了这个问题,我的猜测是它与IIS设置MIME类型等有关......但我无法将手指放在确切的设置上。 – 2016-01-03 00:07:16