Chrome reporting html5 cache manifest mime type incorrectly

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-21 17:46:38

问题


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

The HTML I'm using has this structure:

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

.htaccess in the root folder has the following entry:

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

Response from `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:

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?


回答1:


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.

AddType text/cache-manifest appcache manifest


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



来源:https://stackoverflow.com/questions/7375514/chrome-reporting-html5-cache-manifest-mime-type-incorrectly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!