- 所有的manifest资源配置文件以CACHE MANIFEST声明开头。
- #(哈希标签)有助于提供缓存文件的版本。
- CACHE命令指定哪些文件需要被缓存。
- manifest资源配置文件的内容类型应是“text /cache-manifest”。
以下就是使用http://ASP.NET C#提供的缓存清单。
Response.ContentType = "text/cache-manifest";
Response.Write("CACHE MANIFEST
");
Response.Write("# 2012-02-21 v1.0.0
");
Response.Write("CACHE :
");
Response.Write("Login.aspx
");
Response.Flush();
Response.End();
在创建了缓存清单文件之后,接下来的事情就是提供清单文件在HTML页面中的链接,如下所示。
<html manifest="cache.aspx">
上述文件第一次运行时,它会被增加到浏览器应用程序缓存中,万一服务器宕机的话,页面就可以由应用程序缓存提供服务。