Click here to Skip to main content
11,709,220 members (71,729 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: Cache Offline HTML5/CSS

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
0 Sergey Alexandrovich Kryukov 565
1 OriginalGriff 244
2 Maciej Los 225
3 Peter Leow 219
4 Mika Wendelius 160
0 OriginalGriff 9,348
1 Sergey Alexandrovich Kryukov 8,727
2 CPallini 5,189
3 Maciej Los 4,991
4 Mika Wendelius 3,856

Advertise | Privacy | Mobile
Web04 | 2.8.150819.1 | Last Updated 5 Nov 2012
Copyright © CodeProject, 1999-2015
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