Phonegap离线存储(Phonegap offline storage)
我正在开发一个phonegap iPhone应用程序,该应用程序以HTML文档的形式从网络下载内容,包含文本,图像和嵌入的HTML5视频。
我想下载这些文件,并将它们存储在本地,以便在离线模式下进一步阅读。 我搜索了一下,发现存储这种数据的最佳位置是在应用程序的Documents文件夹中。 但是,我真的不知道如何使用Phonegap API访问它。
我知道如何从js创建XHTML文件,但是如何从/向我自己的应用程序的Documents文件夹读取/写入文件?
I'm working on a phonegap iPhone app which downloads content from the network in the form of HTML docs with text, images, and embeded HTML5 videos.
I want to download these documents as they're available and store them locally, for further reading in offline mode. I've searched a bit and found that the optimal place to store this kind of data would be in the app's Documents folder. However, I don't really know how to access it with the Phonegap API.
I know how to create an XHTML file from js, but how do I read/write files from/to my own app's Documents folder?
原文:https://stackoverflow.com/questions/3541501
最满意答案
已经存在一种Scratch的Javascript副本,称为Waterbear
看看他们的想法实现。
There already is a kind of Javascript duplicate of Scratch, called Waterbear
Have a look at their implementation for ideas.
相关问答
更多-
看起来您正在渲染组件两次,而不是第一次传递用户对象。 要么使组件在没有数据的情况下工作,要么在没有数据可用时不渲染它。 后者是优选的。 所有这些都是基于在用户数据可用时呈现组件的假设。 假设此组件由另一个组件组成,您可以使用条件运算符在JSX中轻松完成: let user = // get user data return (// possible other components // ... {user ? / ...你的模型有一些相互矛盾的陈述。 你首先定义: attr_accessor ... :tag_tokens 然后有: attr_reader :tag_tokens 给定第一行时不必要,反之亦然,因为稍后您对setter有一个定义: def tag_tokens(ids) self.tag_ids = ids.split(',') end 我没有看到tag_ids定义,因为它不是表中的列。 您应该删除attr_accessor定义,然后为starters定义tag_ids方法。 class Tags ...
我如何将计算字段添加到access_token / id_token(How i can add the calculated fields to access_token / id_token)[2024-04-06]
您可以通过在UserManager实现中创建方法来添加包含计算字段的声明。 public class UserManager: IUserManager { ...other code here removed for simplicity public ListGetClaimsAsync(Models.User user) { var claims = new List (); claims ... facebook php sdk如何从javascript sdk获取访问令牌?(How can facebook php sdk get the access token from javascript sdk?)[2023-09-09]
也许这是因为您的访问令牌已过期? 有几种访问令牌类型。 如果您的访问令牌是“短期令牌” - 您必须刷新它。 你可以在这里阅读abot access tokens https://developers.facebook.com/docs/facebook-login/access-tokens/在facebook的python服务器库中,我使用方法fetchToken(appId,secret)来刷新我过期的令牌。 Maybe that happens because your acces token was ...您可以使用PHP在服务器上创建一个简单的代理脚本! 然后,您的JavaScript将调用此脚本,包括事件ID和GET参数中的其他内容,因此调用您的PHP代理将类似于/proxy.php?eventid=123 为了进一步说明这个例子,您可以使用$_SESSION等来确保您的用户在访问之前访问该页面,并且每个页面加载仅允许1个请求或类似的内容。 我准备了一个样本,但你必须修改它以满足你的需求!JavaScript Safari - SyntaxError:意外的标记'>'(JavaScript Safari - SyntaxError: Unexpected token '>')[2022-07-09]
箭头函数()=> {}是es6功能,已经支持firefox和chrome。 但safari旧版本没有。 请访问http://kangax.github.io/compat-table/es6/了解更多信息。 Arrow function ()=>{} is es6 feature, firefox and chrome both are already supported. But safari old version doesn't. Please check http://kangax.github.i ...已经存在一种Scratch的Javascript副本,称为Waterbear 看看他们的想法实现。 There already is a kind of Javascript duplicate of Scratch, called Waterbear Have a look at their implementation for ideas.我想要的是提供几个字段,并根据这些字段生成令牌,当我收到该令牌时,我可以返回那些IDS并访问该特定行。 这不适用于令牌,因为它们是散列或随机的。 如果它是这三个id的散列,你可以从id计算散列,但它几乎是不可能的(散列不可反向计算),以便从散列中获取id。 我会说为取消订阅过程生成一个令牌,然后用该特定令牌删除数据记录是正确的方法。 生成两个相同(如果足够长,例如32个字符)标记的概率几乎可以忽略不计。 要添加,该令牌仅在用户要求取消订阅的时间段内存在,直到他确认该操作为止。 例如, 21EC2020-3A ...railscast 197:尝试使用javascript添加字段时出错(railscast 197 : error when trying to add fields with javascript)[2023-07-16]
您需要删除转义HTML的h函数。 在application_helper.rb : link_to_function(name, h("add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")")) 应该 link_to_function(name, "add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")") You need to ...您可以在分隔符上拆分字符串,然后引用结果数组中的最后一项: var tokenstring = "token1,token2,token3,token4", arr = tokenstring.split( ',' ), lastToken = arr.pop(); // .pop() removes and returns the last item of the array alert( lastToken ); You can probably split the string ...相关文章
更多- HTML5 Local Storage 本地存储
- HTML5 web存储(Web Storage)【HTML5教程 - 第十一篇】
- Failed to read auto-increment value from storage engine错误的解决方法
- phonegap与微信开放平台接口整合
- phonegap分享到微信插件(安卓版)
- phonegap分享到微信插件(iOS版)
- HDFS Datanode数据存储格式分析
- HTML5项目笔记6:使用HTML5 FileSystem API设计离线文件存储
- RedHat 开源其 Hadoop 存储系统
- DataNode本地数据存储和管理
最新问答
更多- 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
- 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
- OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
- 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
- codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
- 在计算机拍照在哪里进入
- 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
- No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
- 单页应用程序:页面重新加载(Single Page Application: page reload)
- 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
- System.StackOverflow错误(System.StackOverflow error)
- KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
- 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
- android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
- TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
- 企业安全培训的各项内容
- 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
- C#类名中允许哪些字符?(What characters are allowed in C# class name?)
- NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
- 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
- 将多个行和可变行移动到列(moving multiple and variable rows to columns)
- 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
- 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
- Angular $资源不会改变方法(Angular $resource doesn't change method)
- 在Angular 5中不是一个函数(is not a function in Angular 5)
- 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
- 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
- 常见的python rpc和cli接口(Common python rpc and cli interface)
- Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
- 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)