HTML and CSS Reference
In-Depth Information
How to serve the manifest
There's one last hurdle to jump before you can take your appli-
cation completely offline: You need to serve the manifest file
properly, meaning it must have the extension .appcache and it
must have the right mime type.
If you're using a common web server like Apache, you need to
add the following to your mime.types file:
text/cache-manifest appcache
There's multiple ways to serve up the right content type depend-
ing on your server of choice; just ensure the web server is send-
ing the text/cache-manifest file header when you request any file
with the .appcache extension. You can test this by checking the
headers of the file requested using a tool like curl :
curl -I http://mysite.com/time.appcache
That should return (something like) this:
HTTP/1.1 200 OK
Date: Mon, 13 Sep 2010 12:59:30 GMT
Server: Apache/2.2.13 (Unix) mod_ssl/2.2.13 OpenSSL/0.9.8l
¬ DAV/2 PHP/5.3.0
Last-Modified: Tue, 31 Aug 2010 03:11:00 GMT
Accept-Ranges: bytes
Content-Length: 113
Content-Type: text/cache-manifest
Now that your server is sending the right headers, and your
manifest file is ready to be used, pat yourself on the back. Let's
take a look at it in action.
NoTE Changing the mime
types on your web server is
beyond the scope of this topic,
but your hosting company can
point you in the right direction.
The browser-server process
When working with the offline applications, it's useful to under-
stand the communication process between the browser and the
server. If at all possible, I recommend running the following com-
mand on your servers to tail your access logs whilst refreshing
your page using the cache manifest to see exactly what's being
pulled. It will show you whether the files from your manifest are
actually being requested and served up by your server:
tail -f logs/access_log
 
 
 
Search WWH ::




Custom Search