开发者

Why isn't my HTML5 Application Cache working?

i have my setup/code as follows (btw, i am following the nettuts quick tip)

// 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. 

update:

log from Live HTTP Headers @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-La开发者_如何学编程nguage: 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

do i see the last line? Content-Type: text/cache-manifest or the 6th Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8.

i think it works now, but if i have jquery from the google cdn, it will not work on 2nd refresh, i think it tries to use local files only?


i think it works now, but if i have jquery from the google cdn, it will not work on 2nd refresh, i think it tries to use local files only?

Every external resource (whether it's on your domain or another) must be accounted for in the manifest. If want to use google's jQuery cdn, you must reference it in your manifest file. Something like this:

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

At the end of my manifests, I usually include the following line to account for any resources that I haven't listed but might be used. It only uses them if there is a network connection:

NETWORK:
*
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜