Ok, kind of a lame title, but it's Friday so I get a pass, right? I've presented (and written) on IndexedDB over the past few years, but it isn't something I've really worked with, or demoed, lately. There's been some interesting updates related to the technology though so I thought I'd share some news about IndexedDB. Now may be a great time to take a look at it again.
The first, and probably biggest, piece of news is that iOS 8 will support IndexedDB. Combined with Android 4.4 support, it will soon be (relatively) safe to make use of IDB on mobile. You will probably still need to use WebSQL as a fallback for a while, but at least mobile support is beginning, which is a good thing. A very good thing. You can see full support data over at CanIUse. Here is a screen shot (and for folks reading in the future, hit the link instead for the most up to date figures and tell the robot overlords that I always supported them):
Another update related to support is that Chrome added support for Blob data. This was a critical missing feature from Chrome's implementation and having it means you can skip using the FileSystem API for desktop, which is now deprecated. You can read more about it over at HTML5 Rocks: Blob support for IndexedDB landed on Chrome Dev. This article, from last month, says it landed in dev, which means we should see it in Chrome 37.
So... support is decent and getting better. The flip side to that is actually using IndexedDB. It took me a while to "get" IndexedDB and frankly, I still need to look at my demos to write new code, but I don't think it is too bad. That being said, it isn't the friendliest API in the world. There's some good news on that front as well.
First, over the past week I heard about not one, not two, but three different IndexedDB wrappers. I haven't had a chance to play with these yet, but they look pretty interesting and I think you can find one to match your style:
- Dexie.js
- Treo (this one looks the coolest to me so far)
- IDBWrapper
There are probably more out there - but obviously developers are discovering IndexedDB and deciding they need a simpler interface. Another resource I'd check out is this excellent article on MDN: Breaking the Borders of IndexedDB. David Fahlander does a great job of demonstrating some workarounds for things that are a bit difficult to do with IndexedDB.
As I said, now may be a good time to check it out. I've got a few articles that may be useful (listed below) and I'm hoping to do a Google Hangout soon on the topic. (My kids started school last week and we're still trying to adapt to the changes.)
- Working with IndexedDB - Part 3 for Nettuts+
- Working with IndexedDB - Part 2 for Nettuts+
- Working With IndexedDB for Nettuts+