-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebstorage-appcache.html
121 lines (86 loc) · 3.56 KB
/
webstorage-appcache.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE HTML>
<!--
written by Nick Shin - [email protected]
the code found in this file is licensed under:
- Unlicense - http://unlicense.org/
this file is from https://github.com/nickshin/CheatSheets/
this file contains some HTML5 snippets on:
- appcache
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
reference sources:
+ http://appcachefacts.info/
+ http://www.html5rocks.com/en/tutorials/appcache/beginner/
manifest attribute can point to an absolute URL or relative path
but an absolute URL must be under the same origin as the web application
<html manifest="example.appcache">
<html manifest="http://www.example.com/example.appcache">
manifest file can have any file extension, but must be served with the
mime-type text/cache-manifest.
For example, in Apache, add to .htaccess config file
(remember to enable mod_rewrite or AllowOverride all):
AddType text/cache-manifest .appcache
----------------------------------------
Updating the cache:
Once an application is offline it remains cached until one of the following happens:
- The user clears their browser's data storage for your site.
- THE MANIFEST FILE IS MODIFIED. Note: updating a FILE LISTED in
the manifest doesn't mean the browser will re-cache that resource.
The manifest file itself must be altered (this includes comments).
- The app cache is programatically (javascript) updated.
If manifest file or resource specified fails to download,
the entire update fails.
Forcing an update server side:
- http://nick.zoic.org/art/html5/taming-cache-manifest-caching.html
----------------------------------------
cached data limited to 5MB - but browsers can adjust this 'suggested' value
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ISSUES:
it seems that browser will show 'cached' files/pages if it has them.
in the FALLBACK section:
+ this works with embedded or linked items, such as:
o <link href> css
o <script src> js
o <a href> link
o <img src> images
o <source src> audio/video
- need to test:
o <iframe src>
o <style> ... { ... url() ... }
* DOES NOT WORK (?) with URLs loaded via javascript
is this too 'dynamic' for the browser to match with these rules?
* also, this does not work with directory listing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
EXAMPLES:
- webaudiovideo.appcache :: cached files only
- eventsource.appcache :: network (online) options
- webstorage.appcache :: all manifest sections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
best viewed in editor with tab stops set to 4
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
-->
<!-- ================================================== -->
<!-- START OF HTML -->
<html manifest='webstorage.appcache'>
<head>
<title>AppCache : WebStoreage : HTML5 test code</title>
<!-- ================================================== -->
<!-- Cascade Style Sheets {{{ -->
<!-- ================================================== -->
<!-- Cascade Style Sheets }}} -->
<!-- Javascript {{{ -->
<!-- ================================================== -->
<!-- Javascript }}} -->
<!-- ================================================== -->
</head>
<!-- ================================================== -->
<!-- START OF BODY -->
<body>
<!-- .................................................. -->
<b>App Cache Tests</b>
<p>
Take a look at the <a href='servers/sse.pl'>servers/sse.pl</a> file (offline).
<p>
<img src='images/large/Jupiter_gany.jpg'>
<!-- ================================================== -->
</body>
</html>