HTML and CSS Reference
In-Depth Information
When you visit a web page that makes use of the cache mani-
fest, such as my time example, here is what happens:
1.
Browser: requests http://introducinghtml5.com/examples/
ch07/time/
2.
Server: returns index.html
3.
Browser: parses index.html and requests all the assets in
the page, images, CSS, JS, and the manifest fi le
4.
Server: returns all requested assets
5.
Browser: processes the manifest and requests all the items
in the manifest, regardless of whether it's just requested
them. This could effectively be a double request for your
application if you're caching all the assets
6.
Server: returns the requested manifest assets
7.
Browser: application cache has updated, trigger an event
stating so
Watch out for dodgy foxes!
Firefox boasts support for offline applications, but it doesn't work properly and has been historically
buggy. If you're testing with Firefox, make sure you're also checking what's actually being requested
from your server by monitoring the server logs. In particular, the manifest should be requested once the
browser is using the cache manifest. Currently Firefox 3.6 doesn't request the manifest, meaning that
you're stuck on that version of your code, which is bad! There is hope! You can tell the browser never to
cache the manifest fi le by adding the following code to your server confi g or .htaccess (or similar) fi le:
If you're using mod_expires for Apache, you need to include the following in your httpd.conf :
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType text/cache-manifest “access plus 0 seconds”
</IfModule>
Yo u a fi s o s e n d c u s t o m h e a d e r s o n r e q u e s t s fi o r . m a n fi fi e s t fi fi e s a n d s e n d a no-cache header:
Header set Pragma “no-cache”
Now the browser has fully loaded the cache using the fi les
listed in the manifest. If the manifest hasn't changed and the
browser is reloaded, here's what happens:
1.
Browser: re-requests http://introducinghtml5.com/
examples/ch07/time/
2.
Browser: detects that it has local cache for this page and
serves it locally
Search WWH ::




Custom Search