【问题标题】:Chrome reporting html5 cache manifest mime type incorrectlyChrome 报告 html5 缓存清单 mime 类型不正确
【发布时间】:2011-11-14 14:05:29
【问题描述】:

我正在尝试为网站设置缓存清单,但运气不佳。演示页面在这里:http://www.matthewlehner.ca

我使用的 HTML 有这样的结构:

<!DOCTYPE html>
<html manifest="manifest.appcache">
</html>

根文件夹中的.htaccess 有以下条目:

AddType text/cache-manifest appcache
AddType text/cache-manifest .appcache

来自`curl -I http://www.matthewlehner.ca/manifest.appcache'的回应

HTTP/1.1 200 OK
Date: Sun, 11 Sep 2011 00:04:30 GMT
Server: Apache
Last-Modified: Sat, 10 Sep 2011 07:53:30 GMT
ETag: "18a84003-32-4ac9196f95280"
Accept-Ranges: bytes
Content-Length: 50
Content-Type: text/cache-manifest

但 OS X 10.6 上的 Chrome 开发人员报告以下错误:

Application Cache Error event: Invalid manifest mime type (text/plain) http://www.matthewlehner.ca/manifest.appcache

显然情况并非如此,但我该如何解决呢?是 Chrome、.htaccess 还是托管问题?

【问题讨论】:

  • 你给我的链接对我有用...
  • 应用程序缓存清单有效吗?
  • 是的!文档是从应用程序缓存加载的,清单 matthewlehner.ca/manifest.appcache 应用程序缓存检查事件 应用程序缓存 NoUpdate 事件 这是在第二次加载之后。
  • 您使用的是什么浏览器/操作系统?也许这是我的 Chrome 的缓存问题。
  • Fedora 15 上的 Google Chrome 13.0.782.215。

标签: html .htaccess mime-types offline-caching application-cache


【解决方案1】:

我遇到了同样的 Chrome 错误,因为我的文档类型是 DOCTYPE!而不是!DOCTYPE。 Chrome 在解析 HTML 方面可能比其他浏览器更严格;尝试将您的代码粘贴到http://validator.w3.org。或者也许在您的 .htaccess 文件中单独尝试以下行。

AddType text/cache-manifest 应用缓存清单


为了便于测试刷新 chrome://appcache-internals 每当您刷新 http://www.matthewlehner.ca

【讨论】:

    猜你喜欢
    • 2013-12-11
    • 2011-03-17
    • 2013-10-24
    • 1970-01-01
    • 2016-05-16
    • 2012-02-20
    • 1970-01-01
    • 1970-01-01
    • 2013-12-29
    相关资源
    最近更新 更多