You are on page 1of 5

Offline Storage Spport

Program Code: Check for Offline Support <!DOCTYPE html> <html class="no-js" lang="en"> <head> <meta charset="utf-8"> <title>Hello Modernizr</title> <script src="modernizr.js"></script> <script> if(Modernizr.applicationcache){ alert("Browser supports offline "); } else { alert("Browser doesnot support this"); }

</script> </head> <body> </body> </html> Introduction to offline Storage All browsers have some sort of caching mechanism. Most of the browsers offer "work offline" feature on top of this mechanism. Leveraging browser's "work offline" feature might appear as an easy way for developing an offline web application but it has the following limitations. 1. In offline mode, only previously visited pages can be viewed 2. To be able to view pages from cache, user has to manually put the browser in offline mode and once internet connection is available, he has to toggle it back to on-line mode 3. A web page can have multiple links and web application developer has no control over which parts of the page (like the external script files, image resources etc) or depth of links that the browser caches when user visits the online web application Browser dumps all web pages that user visits at a common location. Moreover, while cleaning browser's temporary storage, there isn't any way to retain cached pages pertaining to a specific web site or web application. Hence, there are good chances of losing the offline page viewing capability after running cleanup application.

4.

Application caching API begins with manifest attribute on htmlelement. This attribute takes URI of the manifest file.

Manifest file is a simple text file listing the web page resources, like image or external scripts, which the browser should or should never cache. The manifest file can have any name but it has to be identified as text/cache-manifest MIME type resource on web server.

Save the file as: manifest.cache Cache - This section lists the resources which should be cached after loading them. 2. Network - Files listed under this header require a connection to the server, and will never be cached and won't be available offline. 3. Fallback - This section details the backup strategy. If browser fails retrieving original content (koala.jpg in this case) then browser should use fallback resource (Jellyfish.jpg in this case)

You might also like