1.0缓存:Login.aspx?

  • 所有的manifest资源配置文件以CACHE MANIFEST声明开头。
  • #(哈希标签)有助于提供缓存文件的版本。
  • CACHE命令指定哪些文件需要被缓存。
  • manifest资源配置文件的内容类型应是“text /cache-manifest”。

以下就是使用 C#提供的缓存清单。

Response.ContentType = "text/cache-manifest";
Response.Write("CACHE MANIFEST \n");
Response.Write("# 2012-02-21 v1.0.0 \n");
Response.Write("CACHE : \n");
Response.Write("Login.aspx \n");
Response.Flush();
Response.End();

在创建了缓存清单文件之后,接下来的事情就是提供清单文件在HTML页面中的链接,如下所示。

<html manifest="cache.aspx">

上述文件第一次运行时,它会被增加到浏览器应用程序缓存中,万一服务器宕机的话,页面就可以由应用程序缓存提供服务。

posted @ 2020-07-01 12:27  咔啡  阅读(166)  评论(0编辑  收藏  举报