English 中文(简体)
永久本地 UIWebView 值
原标题:Persist Local UIWebView Values

*EDIT* I ve done more research and it looks like cookies may also be the answer. I suppose I would add a button to the form inside the embedded html that calls a function to create a cookie for the values. Then I could access this cookie through obj-c using the stringByEvaluatingJavaScriptFromString method. Of course then you run into the issue of expiration, multiple copies of the form not being allowed, etc. So it is a trade-off of features. I m going to stick with the window.location route because I can store this in a DB and then the user can create another instance of the same form *EDIT*

我做了一些研究,我有一个模糊的想法 如何做到这一点, 但我好奇,如果有更好的方法。

我在开发的 iPad 应用程序上有一个 html 格式 的本地副本。 表格通过 xml 提交服务器端, 并在那里进行解析, 供 DB 存储, 但不幸的是它们相当长。 所以我想让用户将表格保存在目前状态( 可能是他们只填写了一半), 然后稍后再返回 。

我在想的是,我必须写一些插图来解析表格中的收音机按钮和复选框,然后通过窗口传递这些数据。 定位诀窍到 obj- c 代码。 但是,这是非常漫长的, 而在JS 和 Obj- C 之间前后传递的字符串将会很长。 是否有其他方法可以抓住这些复选框/ radio 按钮的值, 并将其传递到 obj- c 侧, 以便稍后重新传播?

最佳回答

如何通过文件? 将设置/ 数据保存到 JS 的文件, 并存到 Ablic- C 土地上 。 但我猜你已经想到了这一点 。

但到最后,不管你怎么做,数据必须传来传去。 通过窗口进行。 定位技巧将是最快的, 只要操作系统本身没有施加任何限制, 是否有任何理由不这样做?

你可以把数据编码成一个浮云 以便更容易传递

但另一方面,通过文件路径进行它可能有用,如果您希望如果应用被终止,设置会持续。

此外,您还可以实际提交表格数据,但在使用NSURL协议衍生类发送前在目标C中截取数据。 THE NSURL协议类可以允许提交文件,如果它知道数据完整的话。但如果窗口没有大小限制,我看不出这样做有什么意义。 位置没有大小限制 。

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签