离线数据库应用程序到在线同步,跨平台,使用HTML5?
对于现实世界客户的学校项目,我们被要求创建一个可以在离线模式下工作的应用程序,以将信息存储到某种数据库中,然后当系统有互联网连接时将该信息与在线数据库同步(需要支持 pc、mac、ios、android,但每种系统类型可能有不同的应用程序)
带有 Web 存储(本地)的 HTML5 是最好的方法吗?所有浏览器似乎都支持它,因此它似乎是在线使用的最佳选择,但它甚至可以用于在无法访问互联网的离线模式下运行吗?我在这里有点迷失了。
For a school project for a real-world client we are being asked to create an app that can work in offline mode to store information into some sort of db, that will then sync that info with an online db when the system has an internet connection (needs to support pc, mac, ios, android, but could possibly be a different app for each system type)
Is HTML5 with Web Storage (local) the best way to go? All the browsers seem to support it so it seems like the best option for online use, but can it even be used to run in an offline mode with no access to the internet? I'm a little lost here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您必须在离线时存储内容,那么 HTML5 的本地存储设施几乎是您最简单的选择;您可能可以使用 Java 或(吐槽)ActiveX 做一些事情,让您访问本地文件系统,但为什么要重新发明轮子呢?
更好的是,已经存在一些库可以让您将“本地”存储同步到网站上的数据库,这应该足以满足您的离线需求:
将本地 HTML5 DB(WebSQL 存储、SQLite)与服务器同步的最佳方式(2 种方式) 为了澄清这一点
,您可以编码以使用本地存储,然后在连接时将本地存储的数据同步到主数据库。
考虑到您要瞄准的众多平台,HTML5 很可能是唯一的解决方案。
If you have to store content when offline, then the local storage facility of HTML5 is pretty much your easiest shot; you could probably do something with Java or (spit) ActiveX that would let you access to local file system, but why re-invent the wheel ?
Better yet, there already exists libraries that let you sync the 'local' storage to the DB on your website, which should suffice for your offline requirement:
Best way to synchronize local HTML5 DB (WebSQL Storage, SQLite) with a server (2 way sync)
To clarify that, you can code to use local storage and then synchronise that locally stored data to the main database when you're connected.
Considering the many platforms you're going to be targeting, HTML5 may well be the only solution.
是的,您走在正确的道路上。 Web Storage 使用客户端的数据库来存储信息,因此您不需要互联网连接。您可以在此处阅读更多相关信息
Yes, you are on the right track. Web Storage uses a db on the client side to store information, hence you do not need an internet connection. You can read up more on it here
有 3 个核心能力需要考虑。
您将在下面的链接中找到更深入的解释:
http://www.sitepoint.com/离线功能-native-mobile-apps-vs-mobile-web-apps/
There are 3 core capabilities to consider.
You will find more in depth explanation in the link below:
http://www.sitepoint.com/offline-capabilities-native-mobile-apps-vs-mobile-web-apps/