2010-09-03 89 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: 
* 
相關問題