科尔多瓦程序是拯救DOM装上Android应用程序的数据空间使用AJAX数据 [英] Cordova app is saving DOM loaded data using AJAX on Android app's Data space

查看:128
本文介绍了科尔多瓦程序是拯救DOM装上Android应用程序的数据空间使用AJAX数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我科尔多瓦+ JQM应用程序有多个模板(跨越子页面和多个HTML文档),其填充有数据使用AJAX请求。我的问题是,我的应用程序的大小增加了每个我在模板中加载数据的时候,如果我以前开了也没关系。而应用程序的细节没有显示增加的缓存,但在数据。缓存是最小的,像一些KBS,但数据将进入以MB。

My Cordova+JQM application has multiple templates (across sub-pages and multiple HTML documents) which are filled with data requested using AJAX. My issue is, my application's size increases each time I load the data in my template, doesn't matter if I have opened it before. And the app's details do not show an increase in Cache, but in Data. The cache is minimum, like a few kbs, but Data goes in MBs.

我的不可以启用数据DOM缓存 JQM的。我甚至尝试调用一个函数之前离开的模板(即从一个HTML文件到另一个),这样来清空DOM数据:

I have not enabled data-dom-cache of JQM. I even tried to call a function to empty the DOM data before leaving the template(that is from one HTML file to another) like this:

$( document ).on( "pagecontainerbeforehide", function() {
  console.log("gonna leave");    
  $("#page-container").empty();
} );

和它没有工作。其实,我不能够调用任何事件而离开(去另一个HTML文档)。

And it didn't work. In fact, I am not able to call any event while leaving (going to another HTML document).

推荐答案

但问题是,无论科尔多瓦通过AJAX收到被缓存到 app_webview /缓存。 所以,我尝试使用文件API删除的内容,但不知何故,一直在失败的;给了一些未知的错误,使调试那是不可能的。

The problem was, whatever Cordova received via AJAX was cached into app_webview/Cache. So, I tried using the File API to delete the content, but somehow it kept on failing; gave some unknown error, so debugging that was impossible.

但这个插件做了的事: https://github.com/Sharinglabs/cordova-plugin -cache 。它与科尔多瓦3.3.1及以上版本兼容。它与我的科​​尔多瓦4.2.0应用程序。

But this plugin did the thing: https://github.com/Sharinglabs/cordova-plugin-cache. It is compatible with Cordova 3.3.1 and above. It works with my Cordova 4.2.0 app.

这篇关于科尔多瓦程序是拯救DOM装上Android应用程序的数据空间使用AJAX数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆