문제

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.

도움이 되었습니까?

해결책

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)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top