This document discusses how to build offline web applications using HTML5 application cache. It begins by introducing offline applications and the browser support for application cache. It then covers checking for browser support, manifest files that list cached resources, and the applicationCache API for updating the cache and handling cache events like downloading, updating and errors. The key aspects are checking browser support, using a manifest file to define cached files, and the applicationCache API to control caching and respond to status changes.
6. How to check? Check if window.applictionCache exists or not if(window.applicationCache){ // the browser supports } else { // it doesn’t }
7. Offline / Online Navigator.onLine is a boolean property to indicate online or not online/offline events of window object
8. Manifest file manifest lists resoures which browsers will cache for offline use Content-type is text/cache-manifest
9. Manifest file CACHE MANIFEST CACHE Serve these files from applicationCache, even if online NETWORK Alway fetch these files from internet FALLBACK Alternate paths to replace resources that can’t fetched
12. applicationCache API- checking event Dispatched when the user agent is checking for an updatem or attempting to donwload the manifst for the first time. This is always the first event in the sequence
13. applicationCache API- downloading event Dispatched when the user agent has found an update and is fetching it, or is downloading the resources listed by the manifest for the first time.
14. applicationCache API- updateready event Dispatched when The resources listed in the manifest have been newly redownloaded. swapCache() to swith to the new cache
15. applicationCache API- obsolete event Dispatched when The manifest was found to have become a 404 page or 410 page, so the application cache is being deleted
16. applicationCache API- cached event Dispatched when the resources listed in the manifest have been downloaded, and the application is now cached.
17. applicationCache API- error event Dispatched when The manifest was a 404 or 410 page, so the attempt to cache the appliction has been absorted The manifest hadn’t changed, but the page referencing the manifest failed to download properly A fatal error occurred while fetching the resources listed in the manifest