HTML5的manifest 本地离线缓存
下面直接放测试代码:
index.html
<!DOCTYPE html> <html manifest="m.manifest"> <head> <meta charset=utf-8"> <link rel="stylesheet" href="test.css"> <script type="text/javascript" src="test.js"></script> </head> <body>
<img src="test.png"> <div class="test"></div> </body> </html>
m.manifest
CACHE MANIFEST
#我是注释,这个文件名叫 m.manifest
CACHE:
test.css
test.png
test.js
test.css
.test {min-height:600px; background:#ddd;}
test.js
alert("cache test");
测试通过
这一行注意了<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">