慕雪1613582
2015-01-11 22:29
屡试不对啊~~~~
<html manifest='manifest.appcache'>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no" />
<title>app cache demo</title>
<link rel="stylesheet" href="css/assets.css" type="text/css" />
</head>
<body >
<h1>APP Cache Demo</h1>
<ul>
<li><img src="img/1.jpg"/></li>
<li><img src="img/2.jpg"/></li>
</ul>
<script type="text/javascript">
window.addEventListener('load',function(e){
window.applicationCache.addEventListener('updateready',function(e){
console.log(window.applicationCache.status);
if(window.applicationCache.status==window.applicationCache.UPDATEREADY){
window.applicationCache.swapCache();
if(confirm('A new version of this site is available. Load it?')){
window.location.reload();
}
}else{
console.log('manifest didn\'t change');
}
},false);
},false);
</script>
</body>
</html>
HTML5存储
55331 学习 · 109 问题
相似问题