0

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

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?

Jiew Meng
  • 84,767
  • 185
  • 495
  • 805
  • Have you checked with LiveHTTPHeaders (or similar) that your AddType rules are working? – robertc Sep 03 '10 at 12:34
  • how do i use Live HTTP Headers? i am seeing HTTP 200 in response code. in firebug net panel, i am seeing GET localhost, style.css & jquery.min.js. but no cache.manifest – Jiew Meng Sep 03 '10 at 14:07
  • Install it from here in Firefox: http://livehttpheaders.mozdev.org/ Then use it (Tools -> LiveHTTPHeaders) to check what content type the manifest is when the server sends it. – robertc Sep 03 '10 at 17:22
  • Which browser are you trying this on? Firefox doesn't support it properly, or at least it's difficult to get it to do so. I wrote up getting mine to work recently: http://www.html5laboratory.com/working-offline.php so something there might help you? – Ian Devlin Sep 04 '10 at 09:20
  • @ian-devlin From the headers he's posted it looks like Firefox 3.6.8. – robertc Sep 04 '10 at 11:03
  • Ah yes, I lazily didn't look at the headers. Anyway, Firefox requires all kinds of fiddles to get it to work. I tried what Remy Sharp suggested in Introducing HTML5 and couldn't get it to work. – Ian Devlin Sep 04 '10 at 12:42
  • I've got stuff to work in Firefox 4.0 beta, but just toy/demo apps rather than real applications. – robertc Sep 04 '10 at 20:18

1 Answers1

0

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:
*
ampersand
  • 4,264
  • 2
  • 24
  • 32