Search code examples
javascripthtml5-appcachecache-manifest

Read appcache manifest value for latest update date


I have a web application running using appcache. This all works great, but I have a problem with a new device, that doesn't have an internal battery. Which means if the device boots up without network connection, the system time will be set to 1.1.1970. Since my web app checks the time in order to display or not display content that is an issue.

So I thought a workaround would be to get the latest update time of my manifest file and use that instead if the system assumes it is 1970. But I am having trouble to find a way to easily do it.

Basically what I want is this:

var now = new Date;

if (now.getFullYear < 2014) {
    now = new Date(2014,6,11); // should be latest update time of manifest
}

Can anyone kick me in the right direction? I feel a bit stupid at the moment.

Thanks


Solution

  • I managed to do it by reading the manifest file via jQuery and then parsing the needed information like this:

    $.get("cache.manifest", function(responseText){
        console.log(responseText);
    })