Disable PhoneGap Caching

I created an html file where I use JavaScript to view a list of tables from a text file. The problem here is that every time I enter a page in PhoneGap on my tablet, it shows me old content. When trying to use it on my computer, I have to enter Ctrl + F5in order to get the latest content.

How can I make an html page to update content in PhoneGap?

I found some meta tags to disable the cache, but this does not work for me.

+4
source share
1 answer

I suggest you use the following plugin:

https://github.com/moderna/cordova-plugin-cache

document.addEventListener('deviceready', onDeviceReady);
function onDeviceReady()
{
    var success = function(status) {
        alert('Message: ' + status);
    }

    var error = function(status) {
        alert('Error: ' + status);
    }

    window.cache.clear( success, error );
}

This will clear your application’s cache every time it starts.

.

+5

Source: https://habr.com/ru/post/1589068/


All Articles