HTML and CSS Reference
In-Depth Information
1. Browser: re-requests
2. Browser: detects that it has local cache for this page and
serves it locally
3. Browser: parses index.html , and all assets in the local
cache are served locally
4. Browser: requests the manifest file from the server
5. Server: returns the updated manifest file
6. Browser: processes the manifest and requests all the
items in the manifest
7. Server: returns the requested manifest assets
8. Browser: application cache has been updated, and triggers
an event stating so.
However, it's important to know that even though the assets
may have changed, any previously loaded assets will not have
changed (for example, images don't suddenly change, and
old JavaScript functions haven't changed). In fact, at this point
in the application's life, none of the new cache is available.
Only when the page is reloaded will the new cached assets
become available.
We'll look at how we can get our hands on these new assets
by looking at the applicationCache object.
The applicationCache is the object that notifies you of changes
to the local cache, but also allows you to manually trigger an
update to the cache. Only if the manifest has changed will the
applicationCache receive an event saying it has updated.
In the process list from the previous section, once the browser
has finished loading the cache with the files from the manifest,
the update event fires on the applicationCache . You could use
this event to tell users that the application they're using has
been upgraded and they should reload the browser window to
get the latest and greatest version of your app. You can do this
using a simple event listener and a notification:
applicationCache.onUpdateReady = function () {
// the cache manifest has changed, let's tell the user to
Search WWH ::

Custom Search