-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp_cache.html
82 lines (58 loc) · 2.46 KB
/
app_cache.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
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Application Cache</title>
</head>
<body>
<h1>HTML5 Application Cache</h1>
<h4>Application Cache means that resources that are used often by the web site may be kept on the local computer and referenced by other web pages so that the information does not have to be downloaded again</h4>
<h4>Include the manifest attribute in the documet's html tag to give the browser the appcache file containing the list of stuff to cache</h4>
<p>
[html manifest="demo.appcache"] The manifest file needs to be served with the correct MIME-type, which is "text/cache-manifest". This setting must be configured on the web server.
</p>
<h2>How the Cache Manifest file works</h2>
<p>
CACHE MANIFEST<br />
/theme.css<br />
/logo.gif<br />
/main.js
</p>
<h4>The line cache manifest is required. The 3 files below it will be cached</h4>
<h4>The Network section means that the files will never be cached</h4>
<p>
NETWORK:<br />
login.asp
</p>
<h4>Use an * if you want all other files to use an internet connection</h4>
<h4>The fallback section contains network files and their replacements in case there is no internet connection</h4>
<p>
FALLBACK:<br />
/html5/ /offline.html
</p>
<h4>If any file in the html5 folder cannot be accessed then offline.html will be used instead</h4>
<h3>Updating the Cache</h3>
<ul>Once an application is cached, it remains cached until one of the following happens:
<li>The user clears the browser's cache</li>
<li>The manifest file is modified (see tip below)</li>
<li>The application cache is programmatically updated</li>
</ul>
<h4>Example - Complete Cache Manifest File</h4>
<p>
CACHE MANIFEST<br />
# 2012-02-21 v1.0.0<br />
/theme.css<br />
/logo.gif<br />
/main.js<br /><br />
NETWORK:<br />
login.asp<br /><br />
FALLBACK:<br />
/html5/ /offline.html
</p>
<h4>The cache is only updated when the manifest file changes so you can use a comment "#" line that changes, but does not change the functionality of the caching</h4>
<h4>Warnings with caching</h4>
<ul>
<li>The cached version will always be prefered even if your site has a newer version</li>
<li>Browsers have different limits for the size of each site's cache. Some are 5mb limit per site</li>
</ul>
</body>
</html>