dumbmatter
dumbmatter

Reputation: 9673

Feature detection of buggy IndexedDB implementations?

I have an IndexedDB-based app. Previously it was easy to do feature detection on IndexedDB - just see if window.indexedDB is defined or not. However, two things have changed recently:

  1. Safari was released with very broken IndexedDB support
  2. I rewrote part of my app to use features (compound indexes and multientry indexes) that IE does not support

So now I need some more fine-grained feature detection to show a reasonable error message to Safari and IE users.

I can imagine testing for IE's missing features wouldn't be too difficult, since at least the problems are documented. But for Safari, there are multiple bugs and I don't know how well it's documented anywhere. Heck, I don't even own any Apple devices that I can run Safari on. And what if some other browser in the future releases a buggy IndexedDB implementation?

Has anyone thought about or solved these problems before? Seems to me like there should be some standard IndexedDB feature detection library, but I can't find anything (Modernizr's IndexedDB stuff doesn't seem sufficient).

Upvotes: 1

Views: 308

Answers (1)

Dick van den Brink
Dick van den Brink

Reputation: 14529

For IE you can check: IDBKeyRange.only([1]), this throws an Exception DataError on IE.

For Safari I did some useragent sniffing because I couldn't find a way to check, (I could have created a dummyDb and check with the inserts if it would remove my other values) but that would be asynchronous making everything a bit more difficult)..

Upvotes: 2

Related Questions