Android の PhoneGap アプリケーションは、キャッシュされたファイルを使用しませんでした。ただし、HTML5 アプリケーション キャッシュは有効になっており、イベントを正しくトリガーします。
HTML5 Application Cache を使用する Web サイトがありました。
索引ファイル:
<!DOCTYPE html>
<html manifest="cache.appcache">
<head>
<link rel="stylesheet" type="text/css" href="site.css">
</head>
<body>
<div>
Hello World
</div>
</body>
</html>
css ファイル:
div{
background-color: red;
}
appcache ファイル:
CACHE MANIFEST
#v1
CACHE:
site.css
Chrome、iOS Web Broswer、iOS の PhoneGap、Android 2.1 Web Broswer でうまく動作します。しかし、Android の PhoneGap では機能しません。
コマンドラインで Android PhoneGap アプリケーションを作成し、起動 URL を自分の Web サイトに変更するだけです。アプリケーションは、アプリケーション キャッシュ イベントを正しくトリガーします。
// Fired after the first cache of the manifest.
appCache.addEventListener('cached', handleCacheEvent, false);
// Checking for an update. Always the first event fired in the sequence.
appCache.addEventListener('checking', handleCacheEvent, false);
// An update was found. The browser is fetching resources.
appCache.addEventListener('downloading', handleCacheEvent, false);
私はファイルを変更していませんcache.appcache
!イベントは、キャッシュが変更されなかったことを示しています。ただし、アプリケーション キャッシュは使用しません。どうしたの?