13

我正在编写一个使用“带有清单的应用程序缓存”的 HTML5 应用程序。

但是,在开发过程中,我想将其关闭。

我尝试从标记中删除清单属性并将清单文件中的所有内容切换到网络。

尽管它确实在第一次更新时进行了更新,但所有子序列更新仍然是从缓存中读取的,而不是从服务器中读取的。

我可以看到 HTML 文件已经更新,并且标签上不再有 manifest 属性,但它仍然从缓存中加载。

一旦你设置它,我似乎无法弄清楚如何关闭它,所以这是我的问题:

有没有办法在 Google Chrome 中关闭“带有清单的应用程序缓存”?

4

6 回答 6

21

在 Chrome 中,转到在引擎盖下 -> 内容设置 -> Cookies -> 显示 cookie 和其他站点数据,应用程序缓存应显示在站点数据下。

在 Firefox 中,转到高级 -> 网络,具有应用程序缓存的站点列在底部的框中​​。

目前还没有办法从服务器端完全删除或过期应用程序缓存。您可以做的最好的事情是明确告诉浏览器删除所有缓存的文件 - 只有一个网络部分的清单应该删除所有其他文件,但具有清单引用的文件本身将始终被缓存。

- 编辑

这个答案不再完全正确。目前标准规定

如果由于 404 或 410 响应或等效响应而导致获取清单失败...将缓存组标记为过时。除了处理已与缓存组中的应用程序缓存相关联的 Document 对象之外,此缓存组不再存在。

即:删除manifest文件应该会导致appcache在下次浏览器尝试更新时被删除

于 2011-01-28T14:45:13.543 回答
3

删除开发计算机中的清单文件。

于 2011-03-02T23:39:35.447 回答
1

您可以通过“--disable-application-cache”命令行开关禁用 Chrome 中的应用程序缓存(这是在 Chrome 的开发通道中,使用 linux 构建......但我确信它在测试版/标准频道,以及其他平台):

google-chrome --disable-application-cache
于 2011-03-07T01:40:13.780 回答
0

我建议每次更改应用程序中的任何内容时,都必须更改清单文件,以便将您刚刚所做的最新修改考虑在内。

当我说更改清单时,您可以在评论中更改版本号,如下所示:

# version 1

这种方式比每次都清理缓存更方便(同时丢失其他站点的其他信息,因此您需要一次又一次地登录......等等)

于 2011-01-28T18:19:21.373 回答
0

在使用带有清单的应用程序时,我创建了两个起始页面: - index.html 包含清单信息 - index.dev.html 不包含清单信息

我通常在我的开发环境中从 index.dev.html 启动,这样我就可以在缓存妨碍的情况下进行调试。调试完代码后,我会从 index.html 文件启动,以确保正确配置了 appcache 文件。

于 2016-09-25T01:37:05.480 回答
0

这适用于桌面和移动 Safari(也在主屏幕)我认为这适用于其他 webkit 浏览器,如 Chrome。

  1. 将所有“.appcache”文件的服务器 MIME 更改为“text/cache-manifest”
  2. 添加到 html

<html manifest="example.appcache">

  1. 使用这个“example.appcache”文件

CACHE MANIFEST
# 2016-01-07:v1.0.4

# This is the default section for entries. Files listed under this header (or immediately after the CACHE MANIFEST) will be explicitly cached after they're downloaded for the first time.
CACHE:


# Files listed in this section may come from the network if they aren't in the cache, otherwise the network isn't used, even if the user is online. You can white-list specific URLs here, or simply "*", which allows all URLs. Most sites need "*".
NETWORK:
*

# An optional section specifying fallback pages if a resource is inaccessible. The first URI is the resource, the second is the fallback used if the network request fails or errors. Both URIs must from the same origin as the manifest file. You can capture specific URLs but also URL prefixes. "images/large/" will capture failures from URLs such as "images/large/whatever/img.jpg".
FALLBACK:

于 2017-05-30T09:20:25.483 回答