Chrome报告html5缓存清单mime类型不正确

时间:2022-12-10 08:07:20

I'm trying to set up a cache manifest for a site and am having little luck. A demo page is here: http://www.matthewlehner.ca

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

The HTML I'm using has this structure:

我正在使用的HTML具有以下结构:

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

.htaccess in the root folder has the following entry:

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

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

Response from `curl -I http://www.matthewlehner.ca/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

But Chrome dev on OS X 10.6 is reporting the following error:

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

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

Clearly this is not the case, but how do I fix this? Is it a Chrome, .htaccess, or hosting issue?

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

1 个解决方案

#1


7  

I was getting the same Chrome error because my doctype was DOCTYPE! instead of !DOCTYPE. Chrome is probably being stricter somehow in parsing your HTML than other browsers; try pasting your code into http://validator.w3.org. Or maybe try the following line alone in your .htaccess file.

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

AddType text/cache-manifest appcache manifest


For ease of testing refresh chrome://appcache-internals whenever you refresh http://www.matthewlehner.ca

为了便于测试,只要刷新http://www.matthewlehner.ca,就刷新chrome:// appcache-internals

#1


7  

I was getting the same Chrome error because my doctype was DOCTYPE! instead of !DOCTYPE. Chrome is probably being stricter somehow in parsing your HTML than other browsers; try pasting your code into http://validator.w3.org. Or maybe try the following line alone in your .htaccess file.

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

AddType text/cache-manifest appcache manifest


For ease of testing refresh chrome://appcache-internals whenever you refresh http://www.matthewlehner.ca

为了便于测试,只要刷新http://www.matthewlehner.ca,就刷新chrome:// appcache-internals