【问题标题】:GET request failing when loading from appcache从 appcache 加载时 GET 请求失败
【发布时间】:2018-08-25 18:39:17
【问题描述】:

我正在使用 HTML5 appcache,它会缓存这些文件:

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

问题是,每当它从缓存加载时,它就会尝试执行 AJAX 获取请求以从服务器获取信息。即使用户在线,请求也会失败。

请求如下。请求是从 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??");
            }

        });

当我删除 appcache 或清除我的缓存时,请求工作正常。关于如何解决此问题的任何想法?

【问题讨论】:

    标签: javascript jquery html html5-appcache


    【解决方案1】:

    如果有人偶然发现此问题并需要修复,请将其添加到您的缓存清单中:

     NETWORK:
    *
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-05
      • 2013-01-15
      • 1970-01-01
      • 2017-05-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多