需要一种方法让用户在离线时输入数据并在重新上线时重新提交
作为一个更大的网络应用程序的一部分,我想构建允许用户在离线时输入数据的功能,然后当他们再次建立连接时将该数据发送回我的网站
对我来说,缺少的部分 ar
- 保存浏览器中的某些数据
- 集保存一个表单,允许他们使用步骤#2中的表单输入数据,
- 以更新步骤#1中的数据
- 从本地数据存储中获取数据并将其发送回服务器
我想保留这个完全在浏览器内,所以...
HTML5 是否满足了其中一些(或全部)目标,因为它目前在 webkit/ff3 中实现?
如果不是,我应该开始研究哪些技术才能完成上述所有目标。
As part of a larger webapp, I want to build functionality that allows a user to enter data while offline -- and then send that data back to my site when they have a connection again
The parts that, to me, are missing ar
- Saving a certain set of data in their browser
- Saving a form that allows them to enter data
- using form from step#2 to update data from step#1
- getting data out of the local data store and sending it back to the server
I would like to keep this entirely within the browser, so...
Does HTML5 meet some (or all) of those goals as it's currently implemented in webkit/ff3?
If not,what technologies should I start looking into in order to accomplish all of the above.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如所列,听起来确实是一个利用 HTML5 的前沿浏览器会为您解决这个问题。
虽然您可能可以不用使用 local/sessionStorage 对象,但我会努力实现客户端数据库。
概述通过缓存清单,您可以在用户离线时轻松维护正常运行的表单。
至于同步新数据,您应该能够通过多种方式获取它,将逻辑和方法留给您自己。
As listed, it sure sounds like a bleeding edge browser utilizing HTML5 would take care of this for you.
While you could probably get away with using the local/sessionStorage object, I'd push to implement a client-side database.
Using a cache manifest you could pretty easily maintain a functioning form while the user is offline.
As for syncing up the fresh data, you should be able to get at it in any number of ways, leaving the logic and the method up to you.
使用 JS 将信息放入 cookie 中是最简单的,然后您可以在后端自动读取该信息(当从服务器请求页面时 - 您知道他们恢复了连接)
或者您想避免使用 cookie 吗?
placing information into a cookie with JS would be the easiest, which you can then automatically read on the backend (and when the page has been requested from the server - you know they got the connection back)
or do you want to avoid cookies?
https://github.com/ankit90anand/offorms
我使用了 localStorage 和 navigator.online
https://github.com/ankit90anand/offorms
I used localStorage and navigator.online