小编jie*_*eun的帖子

应用程序缓存在Android设备中不起作用(在Chrome浏览器上运行良好)

我正在尝试使用应用缓存来批准性能.

我在不同的网站上受过指导.(例如http://xguru.net/621 ......)

make cache.man文件,将mime-type设置为text/cache-manifest.

问题是......

它在谷歌浏览器浏览器上运行良好,但在我的Android手机中不起作用.

我在ICS和Gingerbread进行了测试.

这是清单文件.

CACHE MANIFEST
# manifest version v0.1 

CACHE:
./programs.png
./video.png

NETWORK:
* 
Run Code Online (Sandbox Code Playgroud)

然后,我像这样设置我的webview.

getSettings().setAppCacheEnabled(true);
getSettings().setDomStorageEnabled(true);
getSettings().setPluginsEnabled(true);
getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
Run Code Online (Sandbox Code Playgroud)

(我将cacheMode更改为LOAD_NORMAL,NO_CACHE,但它没有区别.)

要查看缓存状态,我使用此站点. http://jonathanstark.com/blog/2009/09/27/debugging-html-5-offline-application-cache/

var cacheStatusValues = [];
cacheStatusValues[0] = 'uncached';
cacheStatusValues[1] = 'idle';
cacheStatusValues[2] = 'checking';
cacheStatusValues[3] = 'downloading';
cacheStatusValues[4] = 'updateready';
cacheStatusValues[5] = 'obsolete';

var cache = window.applicationCache;
cache.addEventListener('cached', logEvent, false);
cache.addEventListener('checking', logEvent, false);
cache.addEventListener('downloading', logEvent, false);
cache.addEventListener('error', logEvent, false);
cache.addEventListener('noupdate', logEvent, false);
cache.addEventListener('obsolete', logEvent, false);
cache.addEventListener('progress', logEvent, false);
cache.addEventListener('updateready', logEvent, false);

function …
Run Code Online (Sandbox Code Playgroud)

android web-applications application-cache

6
推荐指数
1
解决办法
4461
查看次数