Pergunta

I'm into application cache related work in HTML5. I've added addCacheListeners() in body onload. This works fine with mobile safari and chrome, but NOT with android browser. when it comes to the android browser, error event is fired.

function addCacheListeners(){
        var appCache=window.applicationCache;
        if(appCache!== 'undefined'){
            alert("defined");
            appCache.addEventListener('checking', function(e){
                                      }, false);
            appCache.addEventListener('progress', function(e){
                                      }, false);
            appCache.addEventListener('updateready', function(e) {
                                        alert("update is ready");
                                      if (appCache.status == appCache.UPDATEREADY){
                                        appCache.swapCache();
                                        updateappInfo();
                                        }
                                      }, false);
            appCache.addEventListener('noupdate', function(e){
                                        updateappInfo();
                                        }, false);
            appCache.addEventListener('error', function(e){
                                        alert("error" + e.message);
                                      }, false);
            appCache.addEventListener('cached', function(e){
                                        alert("cached");
                                        updateappInfo();
                                      }, false);
        }

        if (appCache=== 'undefined'){alert("undefined");}
    }

Any idea with regards to this? Thanks a bunch.

Foi útil?

Solução

This issue is with only Android browser as it does not support ‘.manifest’ extension without having MIME type configuration in the hosted server.

Therefore, tried out adding ‘.manifest’ as one of the MIME types, but this was failed as it does not support as a MIME type which is already attached with another reference.

Adding ‘.appcache’ or ‘apache’ was made it functional.

<mimeMapfileExtension=".apache"mimeType="text/cache-manifest" /> 

(source: Load cache manifest file)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top