客户端是否建议使用Web SQL数据库进行存储
用例是让应用程序在离线时在客户端存储数据。 是否建议使用 Web SQL 数据库(Chrome 和 Safari 支持,但不支持 FF),还是等待浏览器实现索引数据库 API?
The use case is to have an application store data on the client side when offline.
Is it advisable to use the Web SQL Database (which Chrome and Safari support, not FF though), or wait for the browsers to implement the Indexed Database API?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
提出此问题 9 个月后,Web SQL 数据库“..不再进行主动维护,Web 应用程序工作组不打算进一步维护它”:http://en.wikipedia.org/wiki/Web_SQL_Database。
如果您正在开发明年发布的解决方案(尤其是移动设备),那么 IndexedDB 是更好的选择。如果您现在需要覆盖范围(不包括 Firefox),那么您可以使用 Web SQL 数据库或将 JSON 对象序列化到 LocalStorage 中。
9 months after this question was posed and the Web SQL Database is "..no longer in active maintenance and the Web Applications Working Group does not intend to maintain it further": http://en.wikipedia.org/wiki/Web_SQL_Database.
If you are developing a solution for release next year (especially mobile) then IndexedDB is the better option. If you need coverage now (excluding Firefox), then you can use Web SQL Database or serializing JSON objects into LocalStorage.
这是一个较旧的线程,但我想投入 2 美分。截至今天,我们正在使用现有的 Web DB API 为 Safari 开发 iOS Web 应用程序。我还没有看到任何迹象表明 Safari 会在未来的版本中放弃这一功能,但是由于这些应用程序现在必须在 iPad 上使用,因此我们正在承担经过计算的风险,并且我们将准备好转向 IndexedDB 如果/必要时。
This is an older thread but I wanted to put my 2 cents in. As of today we're developing iOS web applications for Safari with the existing Web DB API. I haven't seen any indication that Safari is going to drop this in future releases, however since these apps must be used today on iPads, we're taking a calculated risk, and we'll be prepared to move to the IndexedDB if/when necessary.
看起来 WebSQL 即将退出历史舞台,将被 IndexedDB 支持所取代。 Firefox 和 Internet Explorer 没有计划支持 WebSQL,他们希望为 Firefox 4 和 IE9 实现 IndexedDB。 Chrome 正忙于实施它,我相信 Opera 和 Safari 也会效仿。
目前所有支持 HTML5 的浏览器(以及部分 IE 版本)都支持
LocalStorage
,这是一个简单的键/值数据库,只能存储字符串,因此如果您需要更结构化的存储功能,则必须等到今年年底(大约)将提供广泛的 IndexedDB 支持。It looks like WebSQL is on it's way out, to be replaced by IndexedDB support. Firefox and Internet Explorer have no plans to support WebSQL, they want to implement IndexedDB for Firefox 4 and IE9. Chrome is busy implementing it to, I'm sure Opera and Safari will follow suit.
Currently all HTML5 capable browsers (and some IE versions) support
LocalStorage
which is a simple key/value database that can only store strings, so if you need more structured storage capabilities, you'll have to wait until the end of this year (approx) for broad IndexedDB support.我认为在这样的用例(在线和离线混合)中,还需要考虑数据同步(在本地存储的离线工作成果与主流在线情况下可能存储在服务器中的大部分工作之间) )。显然,这两个选项都没有解决这个问题。
I think in a use case like this (mix of online and offline), one would need to consider data synchronization as well (between the fruit of offline work stored locally, and the bulk of work presumably stored in the server for the mainstream online case). Apparently, neither option addresses this.
如果您需要 Firefox 支持,那么显然不需要。
If you need Firefox support, then obviously no.