2010-09-03 90 views
0

我有我的设置/代码如下所示(顺便说一句,我下面的nettuts quick tip为什么我的HTML5应用程序缓存不工作?

// index.html 
<!DOCTYPE HTML> 
<html lang="en-US" manifest="cache.manifest"> 

// cache.manifest 
CACHE MANIFEST 
# version 2 
index.html 
style.css 
scripts.css 

// httpd.conf (i tried having a local .htaccess too) 
AddType text/cache-manifest .manifest 
AddType text/cache-manifest manifest // i have this as its whats shown in the video. anyway even if i remove this it still fails. 

更新

日志从现场HTTP头@pastebin

http://localhost/cache.manifest 

GET /cache.manifest HTTP/1.1 
Host: localhost 
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729; .NET4.0E) FirePHP/0.4 
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 
Accept-Language: en-us,en;q=0.5 
Accept-Encoding: gzip,deflate 
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 
Keep-Alive: 115 
Connection: keep-alive 
Referer: http://localhost/ 
X-Moz: offline-resource 
Pragma: no-cache 
Cache-Control: no-cache 

HTTP/1.1 200 OK 
Date: Sat, 04 Sep 2010 03:14:16 GMT 
Server: Apache/2.2.16 (Win32) PHP/5.3.3 
Last-Modified: Sat, 04 Sep 2010 03:14:09 GMT 
Etag: "700000000238e-42-48f6670db41b9" 
Accept-Ranges: bytes 
Content-Length: 66 
Keep-Alive: timeout=5, max=94 
Connection: Keep-Alive 
Content-Type: text/cache-manifest 

做我看最后一行? Content-Type: text/cache-manifest或第6 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

我认为它的工作现在,但如果我从谷歌CDN jQuery,它不会在第二次刷新工作,我认为它只尝试使用本地文件?

+0

您是否使用LiveHTTPHeaders(或类似的)检查过您的AddType规则正在工作? – robertc 2010-09-03 12:34:30

+0

我如何使用Live HTTP头?我在响应代码中看到HTTP 200。在萤火虫网络面板中,我看到GET localhost,style.css&jquery.min.js。但没有缓存.manifest – 2010-09-03 14:07:55

+0

在Firefox中从此处安装它:http://livehttpheaders.mozdev.org/然后使用它(工具 - > LiveHTTPHeaders)来检查服务器发送它时清单的内容类型。 – robertc 2010-09-03 17:22:09

回答

0

我觉得现在的工作,但如果我有 jQuery的来自谷歌的CDN,这会不会 2日刷新工作,我认为这 只试图使用本地文件?

每个外部资源(无论是在您的域还是其他)都必须在清单中进行核算。如果想要使用谷歌的jQuery cdn,你必须在清单文件中引用它。事情是这样的:

https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js 

在我的清单的结尾,我通常包括以下行来说明我还没有上市,但可能会使用的任何资源。如果有网络连接,它只会使用它们:

NETWORK: 
* 
相关问题