11

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?

rnella01
  • 151
  • 1
  • 1
  • 6
  • I know this is a bit late, but for future projects, try: SequelSphere (www.sequelsphere.com). It is an HTML5 Relational Database Engine that supports SQL and stores it's data in Local Persistence. It does not use WebSQL databases, but rather is its own SQL engine. As such, it will work in any JavaScript compliant browser. While it currently only supports Local Storage, SequelSphere will eventually support other local persistence engines such as IndexedDB and File API. For full disclosure: I am related to the company SequelSphere. :) – John Fowler Nov 07 '12 at 13:35

5 Answers5

8

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.

Rebecca
  • 13,914
  • 10
  • 95
  • 136
  • 1
    i took the "serialize JSON objects to LocalStorage" approach for now. Will definitely revisit IndexedDB approach once it is implemented by all the major browser vendors. For now i found this useful: http://goo.gl/kwaAU – rnella01 Jan 27 '11 at 17:05
2

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.

MrYukon
  • 21
  • 1
  • looks like IndexedDB is now supported in the latest version of the browsers, it is probably time to experiment with it and share some experiences... – rnella01 Apr 15 '11 at 13:13
  • @mella01 indexeddb is not supported on current mobile browsers. the exception being BlackBerry 10 (of all things!). Ref: http://caniuse.com/#search=indexeddb – oligofren Aug 06 '13 at 08:04
1

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.

Sunday Ironfoot
  • 12,840
  • 15
  • 75
  • 91
  • I am looking for a structured storage, may be CouchDB is probably the choice for now. – rnella01 Jun 10 '10 at 13:44
  • 1
    CouchDB won't run in the browser (AFAIK), it's a database technology that runs on the server, so it won't work with HTML5 Offline Storage. – Sunday Ironfoot Jun 11 '10 at 14:44
  • "It looks like WebSQL is on it's way out, to be replaced by IndexedDB support" Is this really the case? I've seen some discussion of the subject... http://sites.google.com/a/chromium.org/dev/developers/design-documents/indexeddb https://lists.webkit.org/pipermail/webkit-dev/2010-January/011409.html ...but Google only announced Chrome Web SQL support on 25 January: http://blog.chromium.org/2010/01/more-resources-for-developers.html ...and Safari has continued to support Web SQL since Safari 3.1 and iPhone OS 2.0: http://bit.ly/c7z1Pe – Sam Dutton Aug 11 '10 at 13:27
  • Webkit browsers (Chrome and Safari) have had WebSQL support for a while, and will continue to include it for quite some time (once you add something, it takes a very long time to remove it because of backwards compatibility concerns). Look at this way, both IE and Firefox won't be implementing WebSql and those are the two largest browsers in the world in market share, so that kinda rules out WebSql. An interim solution might be to have both Sql and IndexedDB code on your web apps, but that's a very temporary solution, both the Webkit browsers (and Opera) will implement IndexedDB eventually. – Sunday Ironfoot Aug 11 '10 at 16:33
1

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.

NovisM
  • 11
  • 1
  • In our case we built a javascript framework that takes care of the synchronization when the user logs into the system when online. – rnella01 Apr 28 '11 at 13:01
0

If you need Firefox support, then obviously no.

  • So, if your target is mobile internet devices (SmartPhones) then you'd be OK with web SQL since most platforms are WebKit or IE. – Marc Dec 05 '10 at 10:18