我正在使用HTML5离线存储
<!DOCTYPE html>
<html lang="en" manifest="/offline-cache.manifest">
<head>
<meta charset="utf-8">
<title>HTML5 offline code demo</title>
</head>
<body>
<div id="content">
<img src="http://increaserss.com/wp-content/uploads/flickr-rss.jpg" alt="img to be cached" />
</div>
</body>
</html>
CACHE MANIFEST
#just want to cache that remote image only
http://increaserss.com/wp-content/uploads/flickr-rss.jpg
RewriteEngine On
AddType text/cache-manifest .manifest
首次使用互联网加载页面,然后禁用互联网并尝试访问此index.html,缓存工作正常,但如果我点击f5,图像未显示(只有替代文字在那里),当我点击网址栏并点击回车(好像是一个新请求)它工作正常...任何方式维持页面刷新缓存(f5)?
答案 0 :(得分:1)
我首先验证您是否可以提取服务器上没有的资产然后缓存它们?我想你可能会模糊浏览器缓存和HTML 5应用程序缓存之间的界限?
我还要确保您没有使用Internet Explorer,因为它不支持脱机缓存。
缓存清单还应包含CACHE MANIFEST标头之后的版本#(例如#1.4版),缓存文件应位于CACHE:标头下。例如。
CACHE MANIFEST
# version 1.4
CACHE:
images/flickr-rss.jpg
请告诉我们你是怎么做出来的。
答案 1 :(得分:0)
您使用的是完整网址,图片不在同一台服务器上?如果是这样,那可能会阻止它被缓存。如果您使用Chrome,则会将缓存事件报告给控制台。