Click here to Skip to main content
13,056,966 members (44,262 online)
Rate this:
Please Sign up or sign in to vote.
See more:

I've got a website which uses a cache manifest so it can work offline. I've recently had a problem where I've switched the live site to a holding page. This switches any requests for the cache manifest to return a http 404.

In this instance the whole page tried to update and ended up killing the application resulting in the main page reloading with again another 404 result.

The client device is an iPad.

The following is my code:

/// Start Cache Manifest
swapCM = function (e) {
    try { window.applicationCache.swapCache(); } catch (ex) { }
    $('divLoadingText').innerHTML = 'Loading new application version...'
    setTimeout(window.location.reload, 2000);
window.addEventListener('load', function (e) {
    $('divLoadingText').innerHTML = 'Checking current application version...'
    window.applicationCache.addEventListener('updateready', swapCM, false);
    if (window.applicationCache.status != window.applicationCache.UPDATEREADY) {
}, false);

Does anyone know how this can be modified to check for none http 200 results and to ignore the refresh when this happens?
Posted 5-Nov-12 5:44am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170728.6 | Last Updated 5 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100