缓存清单导致$.getJSON停止
Cache manifest causes $.getJSON to stop
我正在使用HTML5, Javascript, jQuery mobile和离线存储开发一个移动应用程序。
我有一个wep应用程序,为移动应用程序提供JSON对象数组(在同一域上)。它获取JSON对象,将它们存储在websql数据库中,然后用它们创建一个无序列表,可以单击…
这个想法是,当设备处于离线模式时,我将从离线数据库中提取数据,并绕过从web应用程序获取JSON,然后当设备下一次在线时,它可以获得数据的新副本。
我已经到了创建缓存的部分。清单文件。基本上是这样的:
CACHE MANIFEST
CACHE:
index.html
app.html
NETWORK:
http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.js
http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.css
http://code.jquery.com/jquery-1.4.3.min.js
js/data.js
js/script.js
但是当我添加
<html manifest="cache.manifest">
并重新加载页面$。getJSON停止(可以在data.js中找到)。该文件中的其他JS代码似乎执行了该函数。
下面是加载时执行的函数:
function getAppointments(){
// Update appointments ONLY when online
if(navigator.onLine = true){
console.log('Application Online.')
// create appointments table
createAppTable();
$.getJSON("http://site.com/OptiQuoteApp/index.php/appointments/download/", function(data) {
$.each(data,function()
{
// Save appointments in database
updateAppointments(this.quote_id, this.start_date, this.reference, this.first_name+' '+this.last_name, this.comment);
});
getAppointmentsList();
});
}else{
console.log('Application Offline.')
}
getAppointmentsList();
}
。我知道上面写着site.com(为了安全…)
脚本到createAppTable();
有人知道吗?
比利感谢
尝试在manifest文件"NETWORK:"下面添加*。这样,任何没有特别缓存的内容都将从您的站点中删除。
NETWORK:
http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.js
http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.css
http://code.jquery.com/jquery-1.4.3.min.js
js/data.js
js/script.js
*
相关文章:
- jQuery UI自动完成突然停止工作
- 单击F5时如何停止页面加载
- JavaScript打印功能使日历停止工作
- 如何在未直接触发的情况下停止事件
- 播放当前视频时如何停止其他视频?JavaScript
- 我已经创建了一个jquery转盘,并使用if条件来运行和停止转盘
- 如何将getJson的响应保存在全局变量中
- 停止jQuery UI滑块移动超过给定值
- Jquery未定义函数正在停止其他操作
- css停止图像在滚动中移动
- 下拉列表在使用z索引放置在前面后停止工作
- 通过幻灯片更改事件停止使用jquery的音频
- 如何永久停止jshint'只读'警告/错误
- 如何在jquery中停止在更改时追加值
- 只在滚动时播放循环css动画-滚动停止时停止
- 由于响应中不存在“Access Control Allow Origin”标头,跨域请求停止工作
- 正在停止.在jquery中的特定时间间隔内,每次迭代的每次执行
- 谷歌地图停止显示点v3
- $.getJSON 和 google fonts API 停止在 Internet Explorer 中工作,jQuer
- 缓存清单导致$.getJSON停止