Offline Application Cache
by jonathanstark on Aug 25, 2010
- 2,372 views
Accessibility
Categories
Tags
Upload Details
Uploaded via SlideShare as Apple Keynote
Usage Rights
© All Rights Reserved
Statistics
- Favorites
- 2
- Downloads
- 28
- Comments
- 0
- Embed Views
- Views on SlideShare
- 2,339
- Total Views
- 2,372
- Creating a manifest file
- Adding the manifest attribute to HTML open tags
- Enabling the text/cache-manifest content type
In the background, all the files listed in the manifest will be downloaded locally to the user’s device.
Once the download completes and the user refreshes the page, she’ll be accessing the local files only. She can now disconnect from the Internet and continue to access the web app.
When the user does have access to the Internet and navigates to the URL of our web app, her browser checks the manifest file on our site to see if it still matches the local copy. If the remote manifest has changed, the browser downloads all the files listed in it. It downloads these in the background to a temporary cache.
The comparison between the local manifest and the remote manifest is a byte-by-byte comparison of the file contents (including comments and blank lines). The file modification timestamp and changes to any of the resources themselves are irrelevant when determining whether or not changes have been made.
If something goes wrong during the download (e.g., the user loses her Internet connection), then the partially downloaded cache is automatically discarded and the previous one remains in effect. If the download is successful, the new local files will be used the next time the user launches the app.