Question

I am trying to use indexedDB in Firefox 12 in a web worker.

dbRequest = mozIndexedDB.open("mydb","test db");

However Firefox shows an error: mozIndexedDB is undefined

Tried few others such as self.mozIndexedDB, moz_indexedDBSync but to no avail.
It works great in Chrome using webkitIndexedDB.

Any help would be greatly appreciated...

Was it helpful?

Solution

I ran into something similar a couple of months ago. Firefox doesn't support this (yet):

IndexedDB includes both a synchronous and an asynchronous API. The synchronous API is intended for use with WebWorkers (However, IndexedDB is still not supported in Web Workers as of Dec 2011); while the asynchronous API is intended for normal web use. In the majority of cases where you use IndexedDB, you will use the asynchronous API, therefore this article discusses how you can use the asynchronous API.

From https://developer.mozilla.org/en/IndexedDB/Using_IndexedDB

OTHER TIPS

From the IndexedDB Specification, the Sync API could be removed

Features at risk

The following features are at risk and may be removed, due to potential lack of implementations.

3.3 Synchronous APIs

Also, note that you could use the asynchronous API inside web workers too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top