HTML and CSS Reference
In-Depth Information
If you are using localhost for the web server domain you will need to shutdown the web
server to simulate offline mode, since even without network connectivity your browser can
access the localhost domain.
Unfortunately, if you shutdown the web server and attempt to load the application you will
discover that there is a problem loading the application:
When we attempt to conditionally load files with the jQuery method $.getScript it is ap-
pending the current timestamp to the request, this is to stop the browser caching the script.
This means that the browser does not realise that it has a cached version of this file, and
therefore fails to load.
We could resolve this issue by asking jQuery to suppress this behaviour, but we will instead
solve the problem with the features available in the Application Cache API.
It may seem that you should be able to resolve this with the use of a wildcard in the
FALLBACK section:
FALLBACK:
scripts/tasks-webstorage.js* scripts/tasks-webstorage.js
scripts/tasks-indexeddb.js* scripts/tasks-indexeddb.js
Unfortunately the fallback section does not allow the use of wildcards. Fortunately, the first
URL on each line in the FALLBACK does still represent a pattern: any URL that starts
with the text in the URL will match the line in the FALLBACK. Therefore you can simply
add the following:
FALLBACK:
scripts/tasks-webstorage.js scripts/tasks-webstorage.js
scripts/tasks-indexeddb.js scripts/tasks-indexeddb.js
This will then state that any URL that starts with:
scripts/tasks-webstorage.js
for example:
scripts/tasks-indexeddb.js?_=1379463013652
should be
replaced with the resource :
scripts/tasks-indexeddb.js
Search WWH ::




Custom Search