HTML5缓存Spring项目Ajax调用问题

HTML5 Cache Spring Project Ajax calls issue

本文关键字:调用 问题 Ajax 项目 缓存 Spring HTML5      更新时间:2023-09-26

我有一个springmvc项目,

我想要呈现的页面的脱机功能所以我有一个清单文件,其中包括jsps,css,js,图像等

我面临的问题是

一旦我打开网页,缓存被下载到浏览器,并且我仍然在线,ajax调用就会停止工作(离线时我不需要ajax调用来工作(

这是控制台中显示的错误

GET http://localhost:8080/test/rest/store/1 net::ERR_FAILED
m.ajaxTransport.send @ jquery.min.js:4
m.extend.ajax @ jquery.min.js:4
storeDetails @ index.jsp:143
onclick @ index.jsp:191
jquery.min.js:4 
net::ERR_FAILED(anonymous function) @ jquery.min.js:4m.access @ jquery.min.js:3m.each.m.fn.(anonymous function) @ jquery.min.js:4(anonymous function) @ bootstrap.min.js:6m.fn.extend.on.d @ jquery.min.js:3a.support.transition.a.event.special.bsTransitionEnd.handle @ bootstrap.min.js:6m.event.dispatch @ jquery.min.js:3m.event.add.r.handle @ jquery.min.js:3m.event.trigger @ jquery.min.js:3(anonymous function) @ jquery.min.js:3m.extend.each @ jquery.min.js:2m.fn.m.each @ jquery.min.js:2m.fn.extend.trigger @ jquery.min.js:3a.fn.emulateTransitionEnd.e @ bootstrap.min.js:6

添加

NETWORK
*

对我的缓存文件的ajax调用再次工作!

发送ajax请求时的硬代码,如:

if(isLocalENV){
 jQuery.ajax({
   url:url,
   data:{tms:+new Date(),param1:value1},
   ...
  })};