IndexedDB in Firefox 10
Why in the latest Firefox indexedDB is no more supported? I wrote an offline application that uses IndexedDB for data persistance, but it doesn't work after upgrading Firefox from 9 to 10. It only works on the older version. The same happens for EVERY indexedDB example available on the web. I tried to search on the net, but I didn't found useful answers. What's happening?
All Replies (4)
IndexedDB are supported in Firefox 10.x versions:
- 10.0 -> https://www.mozilla.org/en-US/firefox/10.0/releasenotes/
- 10.0.1 -> https://www.mozilla.org/en-US/firefox/10.0.1/releasenotes/
Further info on IndexedDB for Developers:
Hope this helps.
Unfortunately the issue still remains. As I said, every example available on the web about IndexedDb, doesn't work anymore.
You can have a proof here and here. Pay attention: this happens only in Firefox 10.
It seems that Mozilla changed few basic calls, infact every example analyzed with firebug returns always the same error, the same that I can see in my own script:
The operation failed because the requested database object could not be found. For example, an object store did not exist but was being opened.
P.S one of the not-working examples is the same that appears in Mozilla's Documentation about IndexedDb that you can read here
Modified
Total blackout about this issue. I made some research on the net and I found this (that actually seems the only one) way to make it work. I'll post here the code snippet that I'm currently using.
<SCRIPT>
/* In this example you can see how I use indexedDB data storage.
In my application I need to fill a very very long form, that can be completed in different steps (the first part on the first day, the second part two days later, etc.)
So I start filling my form, then I save it, and close my browser. The day after I load datas from local storage, then I finish filling my entries. When all it's done, I save it again then I push it to an online webserver.
*/
//----------------------------------------- DATABASE MANAGEMENT
// I start creating my offline db.
var indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.msIndexedDB; var IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction; var db; (
function () {
//---------------------------------- INIT DB function initDb() { var request = indexedDB.open("DB_NAME",1);
// OPENING: on success request.onsuccess = function (evt) { console.log('DB opened'); db = request.result; };
// OPENING: on error request.onerror = function (evt) { console.log('Error opening DB '+ evt.target.errorCode); };
// OPENING: on upgradeneeded request.onupgradeneeded = function (evt) { var objectStore = evt.currentTarget.result.createObjectStore("databean", { keyPath: "timeStamp", autoIncrement: false }); objectStore.createIndex("databean", "databean", { unique: false }); };
} // END initDb
//---------------------------------- CONTENT LOADING function contentLoaded() {
initDb();
//---------------------------------- SAVING DATA ENTRIES // I add a listener onclick to button "save"
$('#save').click(function(){
// do some stuff: parsing DOM, getting values from input fields, do calculations, etc. // ...then get a databean object
var transaction = db.transaction("databean", IDBTransaction.READ_WRITE); var objectStore = transaction.objectStore("databean"); var request = objectStore.put(databean);
});
//---------------------------------- LOADING DATA ENTRIES // I add a listener onclick to button "load" too
$('#load').click(function() {
var transaction = db.transaction("databean", IDBTransaction.READ_WRITE); var objectStore = transaction.objectStore("databean");
var request = objectStore.openCursor(); request.onsuccess = function(evt) { var cursor = evt.target.result; if (cursor) { // reitriving databean modeled before from current cursor var databean = cursor.value;
// do some stuff: parsing DOM, putting values into input fields, do calculations, etc. // ...then to next cursor
cursor.continue(); } else console.log('Cursor: no more entries');
}; // END open-cursor-on-success
}); // END event load-on-click
} // END contentLoaded
window.addEventListener("DOMContentLoaded", contentLoaded, false);
})(); // END DB main function
</SCRIPT>
Hello guys some news about this issue. The point is that the old way to use IndexedDB works with Firefox9- and doesn't work with Firefox's latest version. On the other hand the new way to use IndexedDB doesn't work with Firefox9- but it does with Firefox10 (the latest version). What a mess.