简体   繁体   中英

GET request failing when loading from appcache

I'm using the HTML5 appcache, it caches these files:

CACHE MANIFEST

CACHE:
index.html
js/CrosswordController.js
js/CrosswordModel.js
js/CrosswordView.js
js/funcs.js
js/jquery.min.js
css/bootstrap.css
css/bootstrap-grid.css
css/bootstrap-reboot.css
css/style.css

The problem is, whenever it loads from the cache it then attempts to do an AJAX get request to get info from the server. The request fails even though the user is online.

The request is below. The request is done from the CrosswordModel

type: 'GET',
            url: '/getGame',
            dataType: 'json',
            data: {
                name: crosswordName
            },
            success: function (data) {
                console.log(data);
                self.puzzle = data;
                self.clues = JSON.parse(data.jsonArr);
                localStorage.setItem("jsonPuzzle", JSON.stringify(data));
                continueInit();
            },
            error: function (jqXHR, textStatus, errorThrown) {
                console.log(jqXHR, textStatus, errorThrown);

                console.log("DIdn't make it??");
            }

        });

When I remove the appcache or clear my cache, the request works fine. Any ideas on how I can fix this?

In case anyone stumbles upon this and needs a fix, add this to your cache manifest:

 NETWORK:
*

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM