Created
November 5, 2010 06:21
-
-
Save fillano/663725 to your computer and use it in GitHub Desktop.
簡單的離線應用測試,參考http://www.fillano.idv.tw/test642.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="zh-TW" manifest="test642.manifest"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf8"> | |
<script src="test642.js"></script> | |
</head> | |
<body> | |
<input type="button" value="game" id="game"><input type="button" value="update" id="update"> | |
<div id="data"></div> | |
<div id="panel"></div> | |
</body> | |
</html> | |
<script> | |
document.getElementById('game').addEventListener('click', function(){ | |
window.open("test642a.html", null, "height=480,width=640"); | |
}, false); | |
document.getElementById('update').addEventListener('click', function(){ | |
try { | |
applicationCache.update(); | |
} catch(e) { | |
document.getElementById('panel').innerHTML += '<li>Error: ' + e + '</li>'; | |
} | |
}, false); | |
document.getElementById('data').innerHTML = '<li>currentTime: ' + data.currentTime + '</li><li>currentPos: ' + data.currentPos + '</li>'; | |
document.getElementById('panel').innerHTML = '<li>' + applicationCache.status + '</li>'; | |
applicationCache.onchecking = function(){document.getElementById('panel').innerHTML += '<li>checking...</li>';}; | |
applicationCache.onerror = function(){document.getElementById('panel').innerHTML += '<li>error</li>';}; | |
applicationCache.onnoupdate = function(){document.getElementById('panel').innerHTML += '<li>noupdate</li>';}; | |
applicationCache.ondownloading = function(){document.getElementById('panel').innerHTML += '<li>downloading</li>';}; | |
applicationCache.onprogress = function(){document.getElementById('panel').innerHTML += '<li>progress</li>';}; | |
applicationCache.onupdateready = function(){document.getElementById('panel').innerHTML += '<li>updateready</li>';}; | |
applicationCache.oncached = function(){document.getElementById('panel').innerHTML += '<li>cached</li>';}; | |
applicationCache.onobsolete = function(){document.getElementById('panel').innerHTML += '<li>obsolete</li>';}; | |
window.ononline = function(){document.getElementById('panel').innerHTML += '<li>online</li>';}; | |
window.onoffline = function(){document.getElementById('panel').innerHTML += '<li>offline</li>';} | |
</script> |
我懂了!
我到firefox測是沒問題的,
我的chrome版本是101
請問chrome 101不支援嗎?
網路上找不到chrome是否支援applicationCache的資訊QQ
這個技術已經過期了,可以參考:https://caniuse.com/?search=appcache
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
您好:
點擊update按紐時會出現
Error: ReferenceError: applicationCache is not defined
applicationCache 是要自己定義的嗎?
還是是window.applicationCache 呢?
謝謝~