Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I've made a html file where I'm using JavaScript to view a list of table from a textfile. The issue here is that every time I enter the page in PhoneGap on my tablet, it shows me the old content. When trying it on my computer, I have to type Ctrl + F5 to get the latest content.

How can I make my html page update the content in PhoneGap?

I found some meta tags for disabling the cache, but it doesn't work for me.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
253 views
Welcome To Ask or Share your Answers For Others

1 Answer

I would suggest you to 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 the cache of your application everytime you launch it.

You can comment alerts in the callbacks.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...