HTML and CSS Reference
In-Depth Information
Killing the cache
As I mentioned earlier in this chapter, the browsers get pretty sticky
with the cache. It's easy to get stuck in a cycle where you can't
clear the cache to test a change you've made. So far, the spec
doesn't have a method to programmatically clear the cache (for
example, you can't do it from the applicationCache object).
With that in mind, during development I strongly urge you to
avoid using the cache manifest. Make sure your application
development is completely fi nished, and only then move on to
adding the manifest attribute. That said, once you've got the
cache in place, how do you go about clearing it?
Manually. Upgrading to a new cache should be as simple as
changing the contents of the manifest file. As I said before, use
a comment that includes a version number or similar. What if you
want to start again, or what if you want to remove the manifest
attribute all together? You'll only be able to do this during devel-
opment because it requires you to clear the browser's cache (and
depending on the browser, it's tucked away in different places).
For WebKit-based browsers, you need to empty (or clear) the
cache. By cache I mean anything that's been stored to help your
browsing experience go faster. By WebKit, I mean Safari desk-
top, Safari mobile, and Chrome.
WebKit clears the cache for everything except that particular
window, so when you refresh, it's still got the cache manifest
included. This goes for the iPhone, too.
For Firefox, you need to open the preference, go to the
Advanced tab, and select the Network tab. From there you can
clear individual domains cache.
NOTE When you clear the
cache, make sure there
aren't any windows still open
with your application that uses
the manifest.
In the past, websites often failed to work when users weren't
connected to the Internet. Browsers are now beginning to sup-
port this capability, and this chapter showed you how to make
your web apps work without the web.
Search WWH ::

Custom Search