HTML and CSS Reference
In-Depth Information
Both APIs restrict access to reading and writing data to the exact same page domain
(domain, subdomain, schema, port, etc.) as the hosting page, meaning that you cannot
share data across different domains with either of them. This is both a helpful and
frustratingly restrictive reality: the benefit is that data is well protected privacy-wise
(i.e., from other snooping sites), but the downside is that your application's different
services on different domains cannot share their data through this interface.
See Also
For more information on the DOM storage APIs, see this MDC entry: https://developer
.mozilla.org/en/dom/storage .
10.2 Application Caching
Problem
You want to make your web application (including all its resources) available to users
even in an offline state, without relying on the normal browser cache.
Solution
HTML5 defines a special application cache, commonly called the appcache , that allows
you to instruct the browser to cache certain resources—images, CSS, JS, etc.—in a way
that makes them available to the application even if the user's browser is offline and
not connected to the public Internet.
To test if the browser supports appcache functionality, use the following feature-detect:
var appcache_support = !!window.applicationCache;
To utilize appcache in your application, first you need to create a manifest file listing
the resources you want in the appcache . This file might look like:
CACHE MANIFEST
CACHE:
index.html
help.html
style/default.css
images/logo.png
images/backgound.png
The appcache manifest file should include a CACHE section for listing the resources you
want to include in the appcache . You can also specify a NETWORK section for URLs that
need to be dynamically called (e.g., via Ajax) and should never be cached, and a FALL
BACK section that lists local (cached) file fallbacks for any remote URL requests that fail
(such as default content in an offline scenario for a normally online call to a server API).
 
Search WWH ::




Custom Search