哪些客户端关系持久存储选项是新项目的不错选择?
鉴于 WebSQL 已不再开发且 IndexedDB 尚未普及,作为客户端关系存储的开发人员,我们未来的选择是什么?现在最好不要使用这些功能吗?在我的场景中,我最初正在构建一个支持 WebKit(Chrome 和 Safari)的浏览器插件,因此采用 Firefox 和 IE 中尚不支持的技术是可以接受的。我意识到我可以在 Chrome 和 Safari 中使用 WebSQL,但是由于 W3C 规范没有得到维护,因此无法知道这些浏览器对它的支持会保留多久。
Given that WebSQL is no longer being developed and IndexedDB has yet to become prevalent, what are our choices as developers for client-side relational storage going forward? Is it best simply not utilize any of these features for now? In my scenario, I'm building a browser plugin with support for WebKit (Chrome and Safari) initially so it is acceptable to adopt a technology that isn't (yet) in Firefox and IE. I realize I could use WebSQL in Chrome and Safari, but there's no way of knowing how long support for it will stay in those browsers now that the W3C spec isn't being maintained.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果它是一个 Firefox 扩展,那么您可以使用看起来与 WebSQL 非常相似的界面。 SQLite 组件将在 Firefox 中保留很长一段时间,因为它用于许多其他东西,包括(我相信)IndexedDB 实现,只是不允许您从网页访问它。
你是对的,没有办法知道对 WebSQL 的支持将在 WebKit 中保留多久,但 Apple 此前曾表示,即使在实现后,他们仍将继续支持许多
-webkit-
前缀的 CSS 属性标准版本(特别是如果最终标准与其前缀版本不同),因为它们已经得到了如此广泛的使用。我认为 WebSQL 将以类似的方式对待,如果支持被放弃,您至少会收到相当多的警告。歌剧我不确定。
IE 永远不会包含 SQLite,因此它永远不会包含 WebSQL。如果你正在做一个插件,你总是可以以类似于 的方式构建 SQLite 作为它的一部分Gears做到了。
If it's going to be a Firefox extension then you can use an interface that looks very similar to WebSQL. The SQLite component will be staying in Firefox for a long time, because it's used for so much other stuff including (I believe) the IndexedDB implementation, you just aren't allowed to access it from web pages.
You're correct that there's no way of knowing how long support for WebSQL will stay in WebKit, but Apple have previously stated they will continue to support a number of
-webkit-
prefixed CSS properties even after they implement the standard versions (especially if the eventual standard differs from their prefixed version) because they've seen such wide use. I think WebSQL will be treated in a similar fashion and you'll at least have a decent amount of warning if support is ever dropped.Opera I'm not sure about.
IE is never going to include SQLite, so it'll never have WebSQL. If you're doing a plugin anyway you could always just build SQLite as part of it in a similar fashion to what Gears did.
我首先想你肯定搞错了——websql报废了?但是是的,我看到它已经消失了。
我认为显而易见的答案是寻找一个抽象底层存储引擎的 API。如果有什么东西可以让我编写 SQL 并提供故障转移到服务器端数据库的选项,那就太好了 - 但由于 websql 的问题,症结似乎是 SQL 支持。
persistence.js 取得了一些进展。 WSPL 似乎并未取得重大进展。
为 indexedDB 构建 SQL 层看起来是一项艰巨的任务,不太可能很快完成。
看起来很多其他人正在尝试解决类似的问题。例如 1
I first thought surely you must be mistaken - websql scrapped? But yes I see it has gone.
I think the obvious answer would be to look for an API which abstracts the underlying storage engine. It would be wonderful if there was something which allowed me to write SQL with an option to failover to a server-side database - but with the problems for websql, the sticking point seems to be SQL support.
persistence.js goes some of the way. WSPL does not seem to be making big inroads.
Building an SQL layer for indexedDB looks like a huge task which is unlikely to happen soon.
It looks like lots of other people are trying to solve similar problems. e.g. 1
您可以使用 localStorage 变量来存储 json 字符串以保留所有数据,或将其划分到仍位于 localStorage 内的多个变量之间。 了解更多信息。
You can use a localStorage variable to store a json string to keep all your data or divide it between many variables still inside localStorage. Read more about it.